Link to home
Start Free TrialLog in
Avatar of Sue Tippett
Sue TippettFlag for United States of America

asked on

What would be the RegEx pattern in an Access query to return the numeric values until the first alpha?

MS ACCESS 2010
I have a table with a field called CodeLineTxt.  That needs to be pasred into fields LineNbr and LineTxt.

Using a query and RegEX how can I Do this?

I need to get the numeric values for data that looks like this:

10090  If something > 10 then
10091                 SET something = 40
10092  End if

If want just
10090
10091
10092

The numeric does not always have a length of five.  Any numeric value in the remainder of the string is to be ignored.
Avatar of Shaun Vermaak
Shaun Vermaak
Flag of Australia image

^\d*

https://regex101.com/r/tHktl8/1
^ asserts position at start of the string
\d matches a digit (equal to [0-9])
* Quantifier — Matches between zero and unlimited times, as many times as possible, giving back as needed (greedy)
Global pattern flags
g modifier: global. All matches (don't return after first match)
m modifier: multi line. Causes ^ and $ to match the begin/end of each line (not only begin/end of string)
ASKER CERTIFIED SOLUTION
Avatar of Rey Obrero (Capricorn1)
Rey Obrero (Capricorn1)
Flag of United States of America 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
Avatar of Sue Tippett

ASKER

Thank you, great solution!  Sometimes you forget the easier way.