261,004 questions
Score of 3
2 answers
83 views
PowerShell resets $Matches variable to $null after evaluating switch condition
I'm trying get the value of capture groups after a switch statement's conditional has been evaluated with -match. However, it seems that the $Matches hash gets reset to $null when leaving the scope of ...
Advice
1
vote
13
replies
220
views
Perl's Regexp::Common::balanced hangs on some strings
I'm using Regexp::Common::balanced to split up the contents of some latex files. For most files it works fine, but I've found some files for which it is very slow or hangs forever (or at least for ...
Score of -4
1 answer
164 views
Regex matching "not preceded by odd number of given character"
I need to match characters when they are not escaped with a PCRE regex.
Let's say my escape character is # and the character to be matched when unescaped is a1.
A negative lookbehind is OK for a ...
Score of -5
2 answers
207 views
Why is \D+ matching across new lines, despite using multiline flag?
let str = `a
b`;
// ✔
for (let match of str.matchAll (/^.+$/mg))
console.log (match);
// ✔
for (let match of str.matchAll (/^[^0-9]$/mg))
console.log (match);
// ⚠️ problem
for (let match of ...
Advice
0
votes
7
replies
180
views
Regex Search & Replace over multiple lines in Visual Studio Code
I want to turn python code triple quote strings that can possibly span multiple lines into comments using Visual Code. For example, turn
'''line 1'''
to
#'''line 1'''
or
"""
line1
...
Advice
0
votes
10
replies
214
views
Regex Rule to filter a single string character inluding the string Password like "TestPassword"
I'm currently using BetterLeaks and implemented a secret scanner into my Git Pipeline. I also made a local scanner which I run over my code before commiting to be better save than sorry.
I still go ...
Score of -1
1 answer
157 views
Trying to match from final 2 lines, returning too much info
I want to match against only the last two lines of the multiline address (italicized) and return any 5 digit number at the end of either of those two lines, ignoring any 5 digit numbers in the lines ...
Advice
0
votes
6
replies
117
views
Need assistance with regular expression format
I have a regex expression that I use during the textchanged event of a textbox. It is supposed to replace any non alphanumeric characters with only a single instance of the character (such as a comma, ...
Score of 1
0 answers
98 views
Text matches pattern not in the Regex
I have a PHP regex which looks like this:
$special_characters_pattern = '/[£$%*}{~><>|=¬!?]/';
I test user input like this:
$test_value = "station n°12015";
$verified =1;
$...
Score of 4
3 answers
257 views
Output all the paragraphs that match
The regex itself is functional (it matches the paragraph it finds the ^font\.size = 12\.0$ line in), but I can't figure out how to get a suitable Perl executable command to reproduce the result.
I am ...
Score of 1
1 answer
95 views
Informix 12.10 CLOB & RegEx bug?
I am running Informix 12.10 on several Windows servers. I have a simple table. For brevity, let's say the following. I am storing a name, a couple of numbers, the mime type, the actual file/media, ...
Advice
0
votes
10
replies
220
views
regular expression to convert month names to month numbers
I want to know a regular expression which converts from month names to month numbers. Such a thing would make it easy to use a text editor to massage date columns ...
A more extended case would be to ...
Score of 1
3 answers
191 views
PHP API routing with parameters
I have the following route in a PHP router class:
$router->add('/public/bookings/get/{id}', array(
'controller' => 'Bookings',
'action' => 'getBookingId'
));
How do I make the regex ...
Score of 0
1 answer
91 views
RSYSLOG regex stuck on NO MATCH whatever the expression used
I'm trying to use rsyslog regexp feature without any results.
Here a sample log line
May 19 08:52:14 - ansible-exploitation-6cbcf9cb87ty-j8cqw - local0.info - ansible message bla bla bla
What I ...
Score of -3
1 answer
158 views
How to get sum with decimal places if decimal separator is also delimiter
Number pattern
-?[0-9]{1,3}(?:[_,.]?[0-9]{3})*[.,]?[0-9]{0,2}
is used to get amount from invoice text. Decimal separator . can also be number delimiter like
Summa_apmaksai 1640.09._EUR
Tried to get ...