Creating Issues Tags in a LFP

This will show you how to take an LFP and create issue tags at every boundary break.

Additional info:  http://www.regular-expressions.info/

You’ll need an editor that can handle multi-line regex, I suggest EditPadPro and SublimeText3.

 

Search:

^IM,(.*?),([a-z]),(.*)$

Replace:

IM,\1,\2,\3
IS,\1,HelloWorld

Details of Search:   ^IM,(.*?),([a-z]),(.*)$


^
this is an anchor it tells the parser to start at beginning of a line

IM, common text that will be found on all matches in this example (commas used outside of capture groups again to help anchor)

(.*?),the round brackets are the 1st capture group that can be backreferenced in the search as
            well  as the replacement

  
– the dot is a wild card that will match anything (almost)
– the star (asterisk) tells it to keep matching what’s in front of it (
in this case a dot)
– the question mark makes it stop at the first instance of the following character,
    in this case a comma. This modifier to the star is called a non-greedy star

([a-z]),round brackets the 2nd capture group.

   -the [a-z] tells to match exactly one letter a thru z
    (so spaces, ie non-boundary lines, would not match)


(.*)
round brackets are the 3rd capture group. This is considered a greedy-star and
          will match the rest of the line.

$ this is another anchor it tells the parser to match the end of a line

Details of Replacement:   

IM,\1,\2,\3
IS,\1,HelloWorld

The captured groups are referenced in the replacement as \<number>
In this case \1, \2, and \3.

So IM,\1,\2,\3 simply replaces what was already there

And  IS,\1,HelloWorld  adds a new line with HelloWorld issue tag

Rate This Article

(0 out of 1 people found this article helpful)

Leave A Comment?