Note that there are some explanatory texts on larger screens.

plurals
  1. POafter matching pattern how to add dash after string in perl.regex
    primarykey
    data
    text
    <p>i have this type of data: please help me out i am new to regular expressions,and please explain each step while answering.thanks..</p> <pre><code>7210315_AX1A_1X50_LI_MOTORTRAEGER_VORN_AUSSEN 7210316_W1A_1X50_RE_MOTORTRAEGER_VORN_AUSSEN 7210243_U1A_1X50_LI_MOTORTRAEGER_VORN_INNEN 7210330_AV21NA_ABSTUETZUNG_STUETZTRAEGER_RAD </code></pre> <p>i want to extract only this data from above lines:</p> <pre><code>7210315_AX1A_MOTORTRAEGER_VORN_AUSSEN 7210316_W1A_MOTORTRAEGER_VORN_AUSSEN 7210243_U1A_MOTORTRAEGER_VORN_INNEN 7210330_AV21NA_ABSTUETZUNG_STUETZTRAEGER_RAD </code></pre> <p>then if <em>AX1A</em> contains two consecutive alphabets after underscore ,it should be written as AX_ , and if contains single digit and single alphabet then they become as -1_ and -A_ so after applying this pattern it will become: AX_-1_-A_ and all other data should be remain same.</p> <p>similarly in next line "W1A" so firstly it contains single alphabet "W" which should be converted to -W_ now next character is a single digit so it should also be converted as same pattern -1_ similarly last one is also treated same.so it become -W_-1_-A_</p> <p>we are only interested in applying regex to the part after digits followed by underscore.</p> <pre><code>_AX1A_ _W1A_ _U1A_ _AV21NA_ </code></pre> <p>output should be:</p> <pre><code>7210315_AX_-1_-A_MOTORTRAEGER_VORN_AUSSEN 7210316_-W_-1_-A_MOTORTRAEGER_VORN_AUSSEN 7210243_-U_-1_-A_MOTORTRAEGER_VORN_INNEN 7210330_AV_21_NA_ABSTUETZUNG_STUETZTRAEGER_RAD </code></pre>
    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.
 

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