Click here to Skip to main content
15,886,864 members
Home / Discussions / Regular Expressions
   

Regular Expressions

 
GeneralRe: Pattern Check Match Pin
Member 1567083112-Jun-22 11:49
Member 1567083112-Jun-22 11:49 
AnswerRe: Pattern Check Match Pin
Peter_in_278012-Jun-22 12:36
professionalPeter_in_278012-Jun-22 12:36 
GeneralRe: Pattern Check Match Pin
Member 1567083112-Jun-22 13:46
Member 1567083112-Jun-22 13:46 
GeneralRe: Pattern Check Match Pin
Peter_in_278012-Jun-22 15:42
professionalPeter_in_278012-Jun-22 15:42 
AnswerRe: Pattern Check Match Pin
Member 1311558125-Sep-23 16:07
Member 1311558125-Sep-23 16:07 
QuestionAdresse erfassen mittels RegEx Pin
Member 156568991-Jun-22 3:26
Member 156568991-Jun-22 3:26 
AnswerRe: Adresse erfassen mittels RegEx Pin
OriginalGriff1-Jun-22 1:53
mveOriginalGriff1-Jun-22 1:53 
GeneralRe: Adresse erfassen mittels RegEx Pin
Member 156568991-Jun-22 11:39
Member 156568991-Jun-22 11:39 
GeneralRe: Adresse erfassen mittels RegEx Pin
OriginalGriff1-Jun-22 18:59
mveOriginalGriff1-Jun-22 18:59 
AnswerRe: Adresse erfassen mittels RegEx Pin
Richard MacCutchan1-Jun-22 22:01
mveRichard MacCutchan1-Jun-22 22:01 
GeneralRe: Adresse erfassen mittels RegEx Pin
Member 156568992-Jun-22 10:20
Member 156568992-Jun-22 10:20 
Questionget parent LDAP DN - regex Pin
nExoR LU13-May-22 5:12
nExoR LU13-May-22 5:12 
AnswerRe: get parent LDAP DN - regex Pin
Richard Deeming15-May-22 21:40
mveRichard Deeming15-May-22 21:40 
GeneralRe: get parent LDAP DN - regex Pin
nExoR LU15-May-22 21:47
nExoR LU15-May-22 21:47 
QuestionRegular Expressions RegEx - Wildcards for route patterns Pin
Member 1563258311-May-22 6:05
Member 1563258311-May-22 6:05 
QuestionDoubt in Regular Expression Pin
Member 156250644-May-22 20:09
Member 156250644-May-22 20:09 
AnswerRe: Doubt in Regular Expression Pin
Richard Deeming4-May-22 21:17
mveRichard Deeming4-May-22 21:17 
QuestionRegex Lazy Match Zero or More Times (*?) Pin
Member 155940887-Apr-22 2:52
Member 155940887-Apr-22 2:52 
AnswerRe: Regex Lazy Match Zero or More Times (*?) Pin
k50547-Apr-22 4:17
mvek50547-Apr-22 4:17 
GeneralRe: Regex Lazy Match Zero or More Times (*?) Pin
Member 155940887-Apr-22 10:45
Member 155940887-Apr-22 10:45 
Questiondetect and extract phone numbers Pin
aristosv30-Mar-22 23:02
aristosv30-Mar-22 23:02 
AnswerRe: detect and extract phone numbers Pin
jsc427-Apr-22 6:46
professionaljsc427-Apr-22 6:46 
It's a good few years since I wrote RegExps and, even when I did, I could never remember whether ^ was start and $ was end or if it was the other way round.

My totally untested guess is (assuming spaces are only allowed between components and / or at the start or end) is
^\s*((\+|00)?357\s*)?9[4-79]\s*\d{6}\s*$

or allowing spaces between any numbers (and / or at the start or end) is
^\s*((\+|(0\s*){2})?3\s*5\s*7\s*)?9\s*[4-79]\s*(\d\s*){6}$
Note: I'm allowing all whitespace, to just explicitly permit spaces and exclude other white space, change all of the \s patterns to single space chars

I look forward to seeing what someone who actually knows RegExps comes up with to see if I am even remotely close.

Edit: I've just re-read the question - you want to extract the text, not just validate it. What I have written above just validates. A simple way to extract would be to, enclose the whole of the text between ^ and $ in parentheses to get a group. Extract the group and then just drop all spaces. e.g. in Javascript
JavaScript
theGroupThatYouHaveFound.Replace(/\s/g, '');
. An even simpler way would be to use the validation RegExp and then remove spaces from the original string (no messing around with groups).

modified 7-Apr-22 12:58pm.

QuestionMatch all lines except lines beginning with numbers or a few alphabets Pin
Diamond Dallas30-Mar-22 3:06
Diamond Dallas30-Mar-22 3:06 
AnswerRe: Match all lines except lines beginning with numbers or a few alphabets Pin
Member 1311558125-Sep-23 19:35
Member 1311558125-Sep-23 19:35 
Questionfinding repetead pattern Pin
Member 1556742215-Mar-22 6:19
Member 1556742215-Mar-22 6:19 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.