Reply to post

Issue with word boundary regex

Author
jostwald
User
  • Total Posts : 0
  • Reward points: 0
  • Joined: 2016/01/25 10:03:20
  • Status: offline
2016/02/08 10:33:36 (permalink)

Issue with word boundary regex

Hi, are there any known issues matching word boundaries with a \b in a regular expression?
 
I'm trying to match the word "live" using the regex \b[lL]ive\b and it seems to also be matching "alive," which I believe it shouldn't.
 
thanks
John

3 Replies Related Threads

    Admin
    Administrator
    • Total Posts : 275
    • Reward points: 0
    • Joined: 2010/11/22 00:00:00
    • Location: USA
    • Status: offline
    Re: Issue with word boundary regex 2016/02/08 12:24:23 (permalink)
    Hi John,
    I just tested the \blive\b in @Voice, and all seems to work correctly. If you have a problem with a more complex match, please send me the exact RegEx expression you use, and describe the purpose, maybe then I'll be able to help.
     
    Greg
    jostwald
    User
    • Total Posts : 0
    • Reward points: 0
    • Joined: 2016/01/25 10:03:20
    • Status: offline
    Re: Issue with word boundary regex 2016/02/10 11:09:31 (permalink)
    Hi, Greg
     
    The exact regex I was using was \b[lL]ive\b and my replacement text was "liv" the issue was that it was also matching the string "alive" are you finding that that regex does not match "alive"?
     
    thanks
    John
    Admin
    Administrator
    • Total Posts : 275
    • Reward points: 0
    • Joined: 2010/11/22 00:00:00
    • Location: USA
    • Status: offline
    Re: Issue with word boundary regex 2016/02/10 13:06:57 (permalink)
    I would have to see the exact replacements you used and test them. You could export your replacements to a file and email to me as an attachment. The:
     
    \b[lL]ive\b
     
    should not match "alive", because "a" before the "live" part is not a white space, so it does not match \b delimiter.
     
    Greg
    Jump to:
    © 2024 APG vNext Commercial Version 5.1