Click here to Skip to main content
14,868,283 members
Home / Discussions / Regular Expressions
   

Regular Expressions

 
Questionworkaround for negative lookbehind regular expression in Javascript Pin
Ehsan sarshar26-Apr-21 6:27
MemberEhsan sarshar26-Apr-21 6:27 
AnswerRe: workaround for negative lookbehind regular expression in Javascript Pin
Richard Deeming26-Apr-21 6:39
mveRichard Deeming26-Apr-21 6:39 
AnswerRe: workaround for negative lookbehind regular expression in Javascript Pin
Pete O'Hanlon26-Apr-21 21:08
mvePete O'Hanlon26-Apr-21 21:08 
QuestionRegex for a Customer number Pin
poornima sadasivan30-Mar-21 4:11
Memberpoornima sadasivan30-Mar-21 4:11 
AnswerRe: Regex for a Customer number Pin
SeanChupas30-Mar-21 5:27
MemberSeanChupas30-Mar-21 5:27 
AnswerRe: Regex for a Customer number Pin
jschell9-Apr-21 15:21
Memberjschell9-Apr-21 15:21 
QuestionIgnoring repeating values? Pin
Jason Hotchkiss 202124-Mar-21 8:17
MemberJason Hotchkiss 202124-Mar-21 8:17 
AnswerRe: Ignoring repeating values? Pin
w 3g24-Mar-21 10:45
Memberw 3g24-Mar-21 10:45 
GeneralRe: Ignoring repeating values? Pin
Jason Hotchkiss 202125-Mar-21 1:06
MemberJason Hotchkiss 202125-Mar-21 1:06 
QuestionReplace certain characters in part of string? Pin
w 3g22-Mar-21 1:54
Memberw 3g22-Mar-21 1:54 
AnswerRe: Replace certain characters in part of string? Pin
Richard Deeming22-Mar-21 2:08
mveRichard Deeming22-Mar-21 2:08 
GeneralRe: Replace certain characters in part of string? Pin
w 3g22-Mar-21 23:38
Memberw 3g22-Mar-21 23:38 
GeneralRe: Replace certain characters in part of string? Pin
Richard Deeming22-Mar-21 23:49
mveRichard Deeming22-Mar-21 23:49 
GeneralRe: Replace certain characters in part of string? Pin
w 3g23-Mar-21 0:21
Memberw 3g23-Mar-21 0:21 
QuestionRegex only want the first match Pin
Member 150872251-Mar-21 11:04
MemberMember 150872251-Mar-21 11:04 
AnswerRe: Regex only want the first match Pin
Aghast (nj)9-Mar-21 17:53
MemberAghast (nj)9-Mar-21 17:53 
Questionregex pattern in order to get a list of numbers from a string Pin
Rafael Soteldo17-Feb-21 4:48
MemberRafael Soteldo17-Feb-21 4:48 
AnswerRe: regex pattern in order to get a list of numbers from a string Pin
Aghast (nj)9-Mar-21 17:51
MemberAghast (nj)9-Mar-21 17:51 
You don't say what environment you are working in, so it's hard to give you useful code.

However, you can probably get what you want by either doing a search & replace operation, possibly repeated, or by using some kind of "regex iterator" approach.

For C++, it would be a regex iterator (iterate over all the matches of THIS pattern in THAT string). For something like Python it would be find all occurrences of THIS pattern in THAT string.

In order to drop the "8;" from your example sentence, you'd want to provide a better pattern than just "some digits." Instead, use something like /(\d+):/ to match on one-or-more digits followed by a colon. You want to capture the digits, not the colon.

If you can just iterate over all matches in the string, that will probably be enough. If you're doing sed or some other editor, you'll have to search and replace the line. If possible, see if you can do something like a non-greedy match (.*?) to match all the text between matches, and then replace it with a comma. (FYI: The ? operator is a non-greedy modifier in Perl-style regex engines. Other regex engines may not support this at all, or they may have a different syntax-- for example, Vim would use .\{-} for that.
QuestionString Replacement in 'HTML 5 FireFox' Pin
Member 1357268429-Dec-20 0:47
MemberMember 1357268429-Dec-20 0:47 
AnswerRe: String Replacement in 'HTML 5 FireFox' Pin
OriginalGriff29-Dec-20 0:54
mveOriginalGriff29-Dec-20 0:54 
GeneralRe: String Replacement in 'HTML 5 FireFox' Pin
Member 1357268429-Dec-20 1:04
MemberMember 1357268429-Dec-20 1:04 
GeneralRe: String Replacement in 'HTML 5 FireFox' Pin
OriginalGriff29-Dec-20 1:39
mveOriginalGriff29-Dec-20 1:39 
GeneralRe: String Replacement in 'HTML 5 FireFox' Pin
Member 1357268429-Dec-20 1:51
MemberMember 1357268429-Dec-20 1:51 
GeneralRe: String Replacement in 'HTML 5 FireFox' Pin
OriginalGriff29-Dec-20 2:23
mveOriginalGriff29-Dec-20 2:23 
GeneralRe: String Replacement in 'HTML 5 FireFox' Pin
Member 1357268429-Dec-20 9:20
MemberMember 1357268429-Dec-20 9:20 

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.