Here a extract of the manual: How do I specify arbitrary text substitution? Enter text in the Regular expression: text box. The syntax for the string is: /search/replace/g where search is the string to search for and replace is the string to replace search with. By default, only the first occurrence of search is replaced. To replace all instances, add g at the end of the command. For example, if the reader decodes this string: UPC 05214275600 You could replace the string "UPC" with the string "SKU CODE:" by using this substitution string: /UPC/SKU CODE:/ which would produce this output string: SKU CODE: 05214275600 You can enter multiple susbstitution pairs separated by a space. Multiple pairs are used sequentially: the result of the first pair is used as input for the second pair, and so on. AND ALSO: How do I use a wildcard to match different characters or patterns? You can match any single character, any character from a set of characters, any character from a range of characters, or any character that is not within a range of characters using these special characters in the search string: . Match any single character abcd... Match any single character from the set a, b, c, d ... a-z Match any single character within the range of characters a through z (letters or numbers can be used) To invert the sense of a wildcard using a set or range of characters, precede the characters with a ^ character. To match a variable number of characters, append one of the following modifier characters to the character or wildcard being matched:. + matches one or more of the preceding character * matches zero or more of the preceding character ? matches zero or one of the preceding character {n} matches n instances of the preceding character {n,m} matches at least n but not more than m instances of the preceding character {n,} matches at least n instances of the preceding character Here are some examples of wildcard matching: /A.B/AB/g removes any single character between 'A' and 'B' in the input string /A.*B/AB/g removes any number of characters from between 'A' and 'B' in the input string

In reply to Re^5: How to convert a string with regex to a string with a fixed length? by MrQBRIDGE
in thread How to convert a string with regex to a string with a fixed length? by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.