Link to home
Start Free TrialLog in
Avatar of Butler Bros
Butler BrosFlag for United States of America

asked on

How to capture a particular delimited field using REGEX

Need to capture the "3" value using REGEX in the following  string:

"0338829990|10881|188892|ELRET|","","3","","2018-08-23T09:55:23-04:00"
Avatar of Subodh Tiwari (Neeraj)
Subodh Tiwari (Neeraj)
Flag of India image

Does this work for you?
.*"(\d)"

Open in new window

Group1 matches with 3.

Or just this?
"(\d)"

Open in new window

Avatar of Butler Bros

ASKER

It seems to work.

since the "3" field could be any number, I found that "(\d+)" seems to work.
I know \d matches "any digit"...
but, could you explain a little of why this simple regex  works?

Thanks much
ASKER CERTIFIED SOLUTION
Avatar of Subodh Tiwari (Neeraj)
Subodh Tiwari (Neeraj)
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I actually, didn't properly understand groups and their usage.
thank you
You're welcome Richard!
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial