Regex - trying to extract digit group from nth position in string -
first of disclaimer : i'm complete newbie @ regex , have done research try , solve specific issue, getting confused. i'm working on learning basics, don't have luxury of time on side - learn better when trying solve real world problem!
second, context : i'm using regex part of automation program winautomation pull information received emails. has regex ability parse text no actual coding front or end can't use other scripting languages solve problem.
finally, on question.
i looping through emails have been received , need save specific number string email subject.
the raw string looks this:
site: energy use exception - 05/10/2016 - sto : stoke-on-trent office (stoke-on-trent), electricity, 1529102000003
i can number this:
(?:[^, ]*$){1}
however there occasions there data after number:
site: energy use exception - 05/10/2016 - sto : stoke-on-trent office (stoke-on-trent), electricity, 1529102000003, main office
given in case digit between 2nd , 3rd comma found thought might work, it's matching much:
^(?:[^,]*,){2}([^,]*)
how can capture number regardless if there text after or if end of line. feel i'm there, need expert guidance please
Comments
Post a Comment