Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Basically you'll need to convert your simple template into REGEX and you can do this with REGEX:</p> <p>I. <strong>Create the replacement</strong>: </p> <ul> <li>search regex <code>^X+(\W)X+(\W)X+$</code> replace with <code>\\1\1\\2\2\\3</code> </li> <li>this will transform <code>XXX-XXX-XXX</code> into <code>\1-\2-\3</code> <a href="http://regex101.com/r/hZ6yT9" rel="nofollow">explained demo here</a></li> </ul> <p>II. <strong>Create the match</strong>: (two steps)</p> <ol> <li>Create the three groups:<br> <ul> <li>search regex <code>^(X+)\W(X+)\W(X+)$</code> replace with <code>(\1)(\2)(\3)</code> </li> <li>this will transform <code>XXX-XXX-XXX</code> into <code>(XXX)(XXX)(XXX)</code> <a href="http://regex101.com/r/fW6mJ3" rel="nofollow">explained demo here</a> </li> </ul></li> <li>Replace the <code>X</code>'s with dots (<code>.</code> acts as a single character match), over the above operation<br> <ul> <li>this will transform <code>(XXX)(XXX)(XXX)</code> into <code>(...)(...)(...)</code> <a href="http://regex101.com/r/oQ3fI6" rel="nofollow">explained demo here</a></li> </ul></li> </ol> <p>Now you can use your new Match string <code>(...)(...)(...)</code> and new Replacement string <code>\1-\2-\3</code> with the input string <code>ABCDEFGHI</code> and get <code>ABC-DEF-GHI</code> <a href="http://regex101.com/r/yT5gZ6" rel="nofollow">explained demo here</a></p> <p><strong>Notice:</strong> I'm assuming your template will split the input string into 3 parts with 2 <em>(variable)</em> special characters in between</p> <h2>Update:</h2> <p>If the template has variable parts you have to create you <em>match</em> and <em>replacement</em> patterns in advance:<br> Use the regex: <code>\W</code> to <strong>count</strong> the parts in the template, then create your match and replacement patterns. </p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload