Click here to Skip to main content
15,904,653 members
Home / Discussions / Regular Expressions
   

Regular Expressions

 
AnswerRe: Does anyone have experience with creating the regex rule for a fail2ban filter? Pin
jschell7-Feb-24 5:38
jschell7-Feb-24 5:38 
QuestionHelp for a regexp Pin
Member 1616830421-Dec-23 23:43
Member 1616830421-Dec-23 23:43 
AnswerRe: Help for a regexp Pin
Member 1616830422-Dec-23 2:53
Member 1616830422-Dec-23 2:53 
QuestionRegex: more than one identical character next to each other? Pin
Member 1615168129-Nov-23 7:07
Member 1615168129-Nov-23 7:07 
AnswerRe: Regex: more than one identical character next to each other? Pin
Richard Deeming29-Nov-23 22:28
mveRichard Deeming29-Nov-23 22:28 
QuestionHelp me regexp gurus please problem is matching files and copy Pin
Gin Mador11-Nov-23 15:27
Gin Mador11-Nov-23 15:27 
AnswerRe: Help me regexp gurus please problem is matching files and copy Pin
jschell30-Nov-23 6:17
jschell30-Nov-23 6:17 
Questionpattern replace with specific exception Pin
Member 1612263424-Oct-23 1:06
Member 1612263424-Oct-23 1:06 
I am looking for a substution RegEx which prefixes all words with a caret, except when followed by a bracket. E.g. "func(x)=y" must be replaced by "func(^x)=^y" .
I came up with (in Python code):
re.sub(r'([A-Za-z][A-Za-z0-9_]*)([^(]|$)', r'^\1\2', 'func(x)=y')
but that does not work. "f(x)=y" is replaced correctly, but it fails when the word before the bracket has more characters.
I suspect it can be done with a single substitution, but I can't figure it out. I guess my solution does not work because the first bracketed regular expression is not greedy enough. What am I doing wrong?
AnswerRe: pattern replace with specific exception Pin
Member 1612263426-Oct-23 1:02
Member 1612263426-Oct-23 1:02 
AnswerRe: pattern replace with specific exception Pin
Justice Marc20-Nov-23 5:10
Justice Marc20-Nov-23 5:10 
QuestionReplacement of initial words Pin
Luca Smith12-Oct-23 0:47
Luca Smith12-Oct-23 0:47 
AnswerRe: Replacement of initial words Pin
OriginalGriff12-Oct-23 0:50
mveOriginalGriff12-Oct-23 0:50 
GeneralRe: Replacement of initial words Pin
Luca Smith12-Oct-23 0:54
Luca Smith12-Oct-23 0:54 
GeneralRe: Replacement of initial words Pin
OriginalGriff12-Oct-23 1:18
mveOriginalGriff12-Oct-23 1:18 
GeneralRe: Replacement of initial words Pin
Luca Smith12-Oct-23 1:40
Luca Smith12-Oct-23 1:40 
GeneralRe: Replacement of initial words Pin
Dave Kreskowiak12-Oct-23 3:02
mveDave Kreskowiak12-Oct-23 3:02 
AnswerRe: Replacement of initial words Pin
Richard Deeming12-Oct-23 1:45
mveRichard Deeming12-Oct-23 1:45 
GeneralRe: Replacement of initial words Pin
Luca Smith12-Oct-23 1:59
Luca Smith12-Oct-23 1:59 
GeneralRe: Replacement of initial words Pin
Dave Kreskowiak12-Oct-23 3:01
mveDave Kreskowiak12-Oct-23 3:01 
GeneralRe: Replacement of initial words Pin
Terry R 202313-Oct-23 9:22
Terry R 202313-Oct-23 9:22 
GeneralRe: Replacement of initial words Pin
OriginalGriff12-Oct-23 2:38
mveOriginalGriff12-Oct-23 2:38 
AnswerRe: Replacement of initial words Pin
jschell12-Oct-23 5:21
jschell12-Oct-23 5:21 
QuestionRegular Expression for a repeating pattern? Pin
Les Stockton6-Oct-23 7:50
Les Stockton6-Oct-23 7:50 
AnswerRe: Regular Expression for a repeating pattern? Pin
PIEBALDconsult6-Oct-23 7:59
mvePIEBALDconsult6-Oct-23 7:59 
AnswerRe: Regular Expression for a repeating pattern? Pin
RedDk6-Oct-23 8:08
RedDk6-Oct-23 8:08 

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.