Kinook Software Forum

Go Back   Kinook Software Forum > Visual Build Professional > [VBP] General Discussion
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 04-20-2010, 07:56 AM
kodakdave kodakdave is online now
Registered User
 
Join Date: 04-14-2010
Posts: 12
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.
Reply With Quote
  #2  
Old 04-20-2010, 10:32 AM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
You can use negative lookahead to skip text. See the attached sample.
Attached Files
File Type: bld readfile2.bld (620 Bytes, 1630 views)
Reply With Quote
  #3  
Old 04-20-2010, 11:15 AM
kodakdave kodakdave is online now
Registered User
 
Join Date: 04-14-2010
Posts: 12
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?
Reply With Quote
  #4  
Old 04-20-2010, 11:35 AM
kodakdave kodakdave is online now
Registered User
 
Join Date: 04-14-2010
Posts: 12
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....
Reply With Quote
  #5  
Old 04-20-2010, 12:00 PM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
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)])?
Reply With Quote
  #6  
Old 04-20-2010, 03:07 PM
kinook kinook is online now
Administrator
 
Join Date: 03-06-2001
Location: Colorado
Posts: 6,034
This is fixed in the latest download (VisBuildAct.dll version 7.5.1.2 in Help | About | Install Info).
Reply With Quote
  #7  
Old 04-20-2010, 03:31 PM
kodakdave kodakdave is online now
Registered User
 
Join Date: 04-14-2010
Posts: 12
can't wait to try it!! THANKS
Reply With Quote
  #8  
Old 04-21-2010, 08:56 AM
kodakdave kodakdave is online now
Registered User
 
Join Date: 04-14-2010
Posts: 12
Happy to report that this behaves as it should now. great service from Kinook! Thanks all.....
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



All times are GMT -5. The time now is 08:20 PM.


Copyright © 1999-2023 Kinook Software, Inc.