Removed #5 Posted February 26, 2014 Report Share Posted February 26, 2014 (edited) I'm fighting regular expressions - some seem straight forward - this one is giving me fits. Desired replacement (vb.net regex.replace) for a string: begins with either a "("or a "[" [\(\[] possibly a space \s? probably a "v" v? possibly a space \s? possibly an integer \d* <- the problem part possibly a period or space [\.\s] possibly another integer \d* possibly a space \s? then the closing ( or [ [\]\)] so the regex should look like [\[\(]v?\s?\d*[\.\s]?\d*\s?[\)\]] okay, so I left the initial space (2) out and changed the regex to [\[\(]\s?v?\s?\d*[\.\s]?\d*\s?[\)\]] which seems to work. Why did it not present - until the first digits portion of the regex?? This is replacement text in the file name of a book, typically the "version" number of a scanned ebook so there will probably be text before or after the string to be replaced (for testing I'm doing a replace with a "$"). given as input: (22.5) only (v 5.6) one (v1.5) some ( v .5 ) stuff (v15) and I'm getting:$¶ only $ one ¶$¶ some ( v .5 ) stuff¶$¶ Any ideas what I'm doing wrong in there, cause I can't see it??? Edited February 26, 2014 by Al Jones Quote Link to comment Share on other sites More sharing options...
Andy Posted February 27, 2014 Report Share Posted February 27, 2014 Al' that is some very high quality gibberish you're enunciating there Pal Quote Link to comment Share on other sites More sharing options...
Mike101 Posted February 27, 2014 Report Share Posted February 27, 2014 Sorry Al ... I wondered what language you had started to speak Quote Link to comment Share on other sites More sharing options...
Marc Posted February 27, 2014 Report Share Posted February 27, 2014 Will look later Sent from my GT-I9505 using Tapatalk Quote Link to comment Share on other sites More sharing options...
Removed #5 Posted February 27, 2014 Author Report Share Posted February 27, 2014 No, I figured out how to make it work like I wanted, I'm just not sure why the mismatch didn't appear till late in the string. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.