Last post May 31, 2017 01:57 PM by kmcnet
May 29, 2017 04:04 PM|kmcnet|LINK
Hello everyone and thanks for your help in advance. I am trying to develop a regex that will read segments such as :
ABSOLUTE EOSINOPHILS 177
I will plug in the text portion of the pattern such as:
pattern = "LDL-CHOLESTEROL(\ )(0-9)"
but the above doesn't seem to work correctly. There may also be multiple spaces between the letters and number strings that I might have to account for. Any help would be appreciated.
May 29, 2017 04:30 PM|JBetancourt|LINK
the first + means one or more space, you were missing the brackets on [0-9] and the other + for multiple digits
if you want to set the start and the end of the expression then use ^and $ as in:
------------------------Please remember to click "Mark as Answer" the responses that resolved your issue.
May 30, 2017 01:04 AM|kmcnet|LINK
Thanks for the response. If I omit the ^ and $ characters, I pick up most of what I need. I'm not really understanding what those characters are used for.
May 30, 2017 01:55 AM|JBetancourt|LINK
if you don't need ^ and $, then don't use them.
The meaning is:
^ start of string
$ end of string
if you use them this will be a match:
but this wont be a match:
it will basically reject text that doesn't match exactly the expression, while if you omit them it will match any text "including" the expression.
remember to mark the answer that solved your issue
May 31, 2017 01:57 PM|kmcnet|LINK
Perfect. Thanks so much for the help.