#1
|
|||
|
|||
Read File step - regex question
I'd love to see an example of Read File using a regex with a non-capturing group. My step is matching the lines correctly, but even non-capturing groups are captured when I choose "Include all matches":
<step action='Read File'> <AllMatches type='11'>-1</AllMatches> <FailNoMatch type='11'>-1</FailNoMatch> <FileIn>%FOLDER%\p4changes.txt</FileIn> <Find>(?:Change )([[0-9)]]+)</Find> <Log type='11'>-1</Log> <Macro>LIST</Macro> <Match type='3'>1</Match> <NoModS type='11'>-1</NoModS> <indent type='3'>3</indent> <name>Read File</name> </step> I get result of: Change 106 Change 105 etc. but I need result of: 106 105 etc. |
#2
|
|||
|
|||
You can use negative lookahead to skip text. See the attached sample.
|
#3
|
|||
|
|||
That did not work. Many other numbers besides the one "right after" the word "Change " also are captured now. Not sure what negative lookahead is supposed to accomplish.
By offering a workaround, and because non-captured grouping appears to work correctly in the "one match" case, I guess this is just a bug? |
#4
|
|||
|
|||
truly unfortunate. If this non-capturing group would work on "all matches" in the file instead of only the first one, I would not have to write all kinds of tedious code to compensate. oh well....
|
#5
|
|||
|
|||
Including of non-capturing groups appears to be an issue with the regex library being used (or a problem in the way we're calling it), which we will investigate -- please provide a sample of the input string/file you are using.
In this case, could you just remove the 'Change ' prefix while processing the loop values (i.e., [Split("%LOOP_VALUE%")(1)])? |
#6
|
|||
|
|||
This is fixed in the latest download (VisBuildAct.dll version 7.5.1.2 in Help | About | Install Info).
|
#7
|
|||
|
|||
can't wait to try it!! THANKS
|
#8
|
|||
|
|||
Happy to report that this behaves as it should now. great service from Kinook! Thanks all.....
|
Thread Tools | |
Display Modes | Rate This Thread |
|
|