Issue
I have a series of data that I would like to extract a single digit from. I will be using python to execute the regex. This previous post looked promising, but I couldn't get anything working as of yet. More specifically I would like the first numeric digit after the second "." of each string.
This is my attempted regex: [^.][^.]?([0-9])
The below example includes test data with the targeted number in bold. I plan to use this to iterate through a table, so it only needs to work for each individual string, not all of them at once.
Example data:
AR0.RRPG.105
AR6.TR0.500
AR0.GGF0.2FEH
AR0.DER.M15
Solution
^[^\.]*\.[^\.]*\.[^\.]*?([0-9])
- First as many non-dot characters as possible up to the first dot
- Same up to the second dot
- Finally as few non-dot characters as possible, up to the first digit, which is captured
Answered By - LMD
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.