Questions tagged [regex]
Regular expressions provide a declarative language to match patterns within strings. They are commonly used for string validation, parsing, and transformation. Specify the language (PHP, Python, etc) or tool (grep, VS Code, Google Analytics, etc) that you are using. Do not post questions asking for an explanation of what a symbol means or what a particular regular expression will match.
260,518
questions
-1
votes
0
answers
14
views
Perl Why is this lazy regex acting greedily? [duplicate]
my $file = '/a/b/c.xxx';
my $path = $file =~ s'/.*?$''r;
print "$path\n";
$path = $file =~ s'/[^/]*$''r;
print "$path\n";
The second substitution gives what I was expecting a/b ...
0
votes
0
answers
9
views
pwsh7 URL regex help needed
I am working on a powershell core 7 script, running in Windows environment.
Requirements of the regex:
Three or Four part host addresses
The last two parts can be one of two options: specificPartA....
0
votes
0
answers
11
views
Pyspark Regex Lookbehind Beginning Of String [duplicate]
My string in column "Key" is:
"+One+Two+Three-Four"
I want to extract all words following the "+" sign:
df.select(regexp_extract_all("Key", F.lit(r"(?<=...
1
vote
1
answer
23
views
Is there any situation where re.search could not be used instead of re.match? [duplicate]
The documentation seems clear but it begs the question, what is the purpose of re.match? Couldn't re.search with the caret (^) be used instead as long as the MULTILINE flag is not enabled? Is re.match ...
-1
votes
0
answers
14
views
Replacing a sentence that has citations in a DOCX file as Track Changes
I trying to replace a sentence instead of old one (which has citations) in a DOCX document using OpenXmlRegex.Replace method.
The thing is creating the regex of old sentence and using it for replace ...
-1
votes
1
answer
30
views
Bookmark Lines Between Two Regex Patterns in Notepad++ Without Including the Patterns Themselves [duplicate]
I have a list, and here is an example snippet:
Newii
27,807,147
Supd
26,518,465
Ns.
26,175,538
Mai
24,930,812
Gas
0623,901,055
TEim
20,213,631
Tes
GrV
18,968,412
Mytyttyst
y
htththt
hyhyh
October 2013
...
0
votes
1
answer
18
views
Read Response body and assign into one variable in JMeter
I need to read authId value from below response returned by one of the Http Request item in JMeter and assign into in one variable under JSON extractor . "Should I use $.ApiResponse.data.authId&...
0
votes
0
answers
15
views
Regex unicode categories \p{L} combined with a Python formatted string [duplicate]
I would like to write a regular expression in Python that is a formatted string and includes a unicode category.
The regex would look like this:
import regex as re
mystring = "abc"
m = re....
1
vote
1
answer
34
views
Bookmark last comma-separated value before specific separator using Notepad++ regex
I have a list of text data formatted as follows:
Drtyjtyjnt
11,825,222
Ftyryer
8,823,623
Strtrtuperd
8,542,448
Ts
7,153,156
Supd
7,122,304
Su.3
6,920,743
Supld
dddd
tgtgtg
Sd
April 1991
///////////////...
0
votes
1
answer
49
views
Regex not matching group at the end of the string, even though $ is included
The string format is similar to:
1) some question text
A)option
B) option
C) option
D) option
2) some question text.
A) option
B) option
C) option
D) option
etc.....
0
votes
0
answers
24
views
Select2 ajax based results filtering based on regex on client and server side
I have implemented select2 in codeigniter for ajax based results and its working perfectly. But the challenge I am encountering is that the data in database is not sanitized e.g
E.C.G Machine
ECG ...
1
vote
2
answers
53
views
Append to a line only if regexp is found
I have the following Ansible code:
---
- name: skip fail2ban in iptables checkmk plugin
hosts: localhost
gather_facts: no
tasks:
- name: modify plugin
ansible.builtin.lineinfile:
...
0
votes
1
answer
26
views
"if regex.test" doesn't works properly on javascript vuejs router [duplicate]
const router = createRouter({
history: createWebHistory(),
routes,
});
// ...
const allowedToAnonymous = [
/^\/login$/g,
/^\/signup$/g,
/^\/home$/g,
/^\/emailconfirm\/[0-9a-zA-Z]{8}$/g,
...
1
vote
1
answer
51
views
Removing string between two specified strings in Python 3 [duplicate]
I am working on an NLP project that requires me to remove computer code from a piece of text. The code is encased between the tags <pre><code> and </code></pre>. Now I could do ...
0
votes
0
answers
9
views
Non-word characters in SHAP's default tokenizer
My basic question is: why are the non-word characters making it into my SHAP output, and how do I prevent it?
I am applying SHAP to a black-box machine learning model fn_predict_proba() (the model ...