Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

Professional Opinions
Ask a Question
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

troubleshooting Question

Regex extract only the closest numbers at both sides of a word (word boundaries?)

Avatar of novreisb
novreisb asked on
SoftwareC#Microsoft Legacy OSMicrosoft DevelopmentRegular Expressions
6 Comments1 Solution581 ViewsLast Modified:
I want to retrieve only numbers (can have a dot or coma)  that are just before or after one (see below) specific word ( "size" in this case).

123 size 23456 bbb    ->  123  and 23456
aa 123size23456             ->  123 and 23456
1.234 size 55.567       -> 1234 (or 1.234) and 55567
1234 size forget  345            -> 1234
aa12 size 14587          -> 14587

The ideal was to use the expression for several words  as    ?:size|area|length and also ignore characters not belonging to alphabet as space, /,-    ( example "1245/size/ 12"   would return   1245    12) if not too complex!
Can you help me?
Avatar of aikimark
aikimarkFlag of United States of America imageGet vaccinated; Social distance; Wear a mask
This problem has been solved!
Unlock 1 Answer and 6 Comments.
See Answers