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,575
questions
2
votes
1
answer
50
views
How do I fix this Reg ex so that it matches hyphenated words where the final segment ends in a consonant other than the letter m
I want to match all cases where a hyphenated string (which could be made up of one or multiple hyphenated segments) ends in a consonant that is not the letter m.
In other words, it needs to match ...
2
votes
1
answer
64
views
Escaping special characters inside bat file won't act the same
I spend the entire day looking for a solution but without any success. I have a weird bug with a bat file created to unzip 7zip files with. Here is the .bat file:
@echo off
setlocal ...
1
vote
1
answer
45
views
How to match strings having optional group and not containing specific group?
How to match the following cases with regex:
XYZABC
ABC
but not these:
XYZ*ABC
*ABC
in order to capture the ABC part, which can be anything, including a (second) *?
I've tried the following, but it ...
0
votes
1
answer
40
views
Extract all matching font-family attributes from string [duplicate]
I'm trying to extract values of all attributes in an HTML snippet that match font-family:"" pattern
Example input:
`<body lang=EN-ZA style='tab-interval:36.0pt;word-wrap:break-word'>
&...
-4
votes
0
answers
35
views
Using regex for Account Number Extraction [closed]
Using Regex, how to read the accounts from below table in such a manner that from the first row, four IDs can be extracted- 300501798101, 359073848101, 359073848102 and 300501798101 whereas from the ...
0
votes
0
answers
46
views
Javascript regex is working on desktop but not working on mobile
I am using regex in vuejs to manipulate input field data.
below is the code:
<input
v-model="inputValue"
type="text"
:placeholder="placeholder"
:class=&...
1
vote
1
answer
44
views
R split 1 column into several columns based on regex value
I have dataframe like this
col_names
Aceh..........................................................66.29..........................56.49..........................64.01....................................
1
vote
2
answers
50
views
Replace Spaces with New Lines in Comma-Separated Number Lines
I have a list like following:
\u042f 12,197,051
\ube44\ud574 93,721,409
HUMAN 45,754,677
Overwatch 43,437,031 OVERWATE
Now I want to replace spaces with new lines in Comma-Separated number lines like ...
0
votes
3
answers
109
views
Issue while masking Credit Card No. before and/or after spaces
I am having an issue when there is a space before/after in CreditCardNo.
For example from INV 2420852290 to SAV 0165487. Here 2420852290 is 10-digits and still it is getting masked.
For a CreditCardNo,...
2
votes
1
answer
76
views
Using callable_iterator (re.finditer) causes Python to freeze
I have a function that is called for every line of a text.
def tokenize_line(line: str, cmd = ''):
matches = re.finditer(Patterns.SUPPORTED_TOKENS, line)
tokens_found, not_found, start_idx = []...
0
votes
0
answers
31
views
Regex: Find all matches between varying length sets of identical special characters [duplicate]
I have texts similar to this:
<FILE_NAME>
���������������
</FILE_NAME>
<SHEET_NAMES>
['������']
</SHEET_NAMES>
<RAW_STRINGS>
[������������]
Where any length of the ...
3
votes
1
answer
65
views
Making sense of the regex in grep command [closed]
When executing the following command in a bash shell:
grep '^\(.\)*\1$' exp.txt
I expect it to match any line that:
begins and ends with the same latter.
but in reality it matches the following ...
-1
votes
1
answer
49
views
Match string but not if it's preceded by a different word [duplicate]
I want a regex to match "email" but not "verify email".
How can I do this?
I've tried the following but no luck:
[^(verify)] email
3
votes
1
answer
68
views
Extracting specific substrings from a text field in SQL
Consider this snippet code to regenerate the result set:
CREATE SCHEMA "clean";
CREATE TABLE "clean"."InvoiceFact" (
"InvoiceTitle" TEXT
);
INSERT INTO &...
-1
votes
0
answers
16
views
Check if string contains any item of array in mongoose find query [duplicate]
I'm trying to find entries where the title field contains any item of an array.
Here is the relevant part of my schema:
const blogSchema = mongoose.Schema({
title: {
type: String,
required: ...