261,153 questions
3
votes
1
answer
115
views
Regex - How do I check for digits 01 to 52 in filenames? [duplicate]
I have found the answer :-)
It is: ^ghf(0[0-9]|[1-4][0-9]|5[0-2])\d{3}[A-Z]{2}_v\d{2}.pdf$
I receive filenames from a client that are structured according to the following scheme:
ghf50001BE_v02.pdf
...
0
votes
3
answers
107
views
Reducing indentation of specific lines within 1 cell based on contents within line
Incoming with another VBA question.
I'm currently have data within a column that has many line breaks, but certain lines need to be only indented 2 spaces whereas certain lines need to be indented by ...
-11
votes
2
answers
147
views
Crafting a regex that matches anything but two certain strings [closed]
I'm trying to write a regular expression that matches any 3 character string EXCEPT for bin and dev.
No, grep -v is not allowed, nor is negative lookaround
This must be pure regex.
If I wanted to ...
-4
votes
3
answers
181
views
Captures all domain names within a property SubjectAlternativeName
I’m trying to extract a specific portion of text and haven’t had success despite testing multiple patterns and looking at similar examples. After struggling for a while, I figured it was time to ask ...
2
votes
2
answers
133
views
Troubleshooting: A single regular expression matching nested braces usable for java and perl
I have a regular expression in an extension of java by florian ingerl
to parse a latex command,
\\\\DocumentMetadata(?<docMetadata>\\{(?:[^{}]|(?'docMetadata'))*\\})
but the important thing is ...
-2
votes
1
answer
126
views
How can I solve this problem of test difference?
As far as I understand, the difference between expected and actual one is NBSP (Non‐Breaking Space).
I don’t know how to remove this. It doesn’t get highlighted and cannot be found using CTRL+H (...
-2
votes
2
answers
128
views
Detect srt blocks that contain exactly one dash (-) using regex [closed]
I’m working with .srt subtitle files in PHP and I need a regex that finds blocks containing exactly one dash (They're regular hyphens (-), not minus signs) and it starts at the beginning of a line.
...
4
votes
1
answer
97
views
Regular Expression Complex Matching
I'm working on a php project and I need to extract some informations from strings like :
COROLLA CROSS (07/22>09/25<)
I tried different patterns without success, such as:
preg_match("/(?P&...
1
vote
1
answer
86
views
Excluding allowing apostrophe in regex doesn't work [duplicate]
I have this method:
func isNameValid(_ value: String) -> Bool {
let trimmed = value.trimmingCharacters(in: .whitespaces)
guard value == trimmed else { return false }
guard trimmed.count ...
0
votes
1
answer
110
views
Regex - basic string replacement
I have a string which may or may not contain a code for an emote, all of which begin the same: "auroraa1"
Such as:
"auroraa1Smile", "auroraa1Bye", "auroraa1Love&...
-8
votes
4
answers
140
views
JavaScript replace regex produces two trailing commas for "a,b,c " string [closed]
Background
I'm working on processing a comma-separated username list (for an ACL whitelist optimization in my project) and need to normalize whitespace around commas, as well as trim leading/trailing ...
Advice
0
votes
8
replies
144
views
Match a string not preceded by a pattern
I want to match a string according to a pattern but only when it is not preceeded by an other pattern.
const source = "abc.def.Ghi\n\
@:test(abc.def.Ghi2)";
const re = /(?!\()([a-z]\w+\.)+([A-Z]\w*)/g;...
5
votes
2
answers
158
views
Hex escape sequences in bash regex range have no effect
Here is a bash script:
#!/bin/bash
char=$'\x01'
if [[ "$char" =~ ^[\x01-\x20\x7F-\xFF]$ ]]
then
echo "Unprintable"
else
echo "Printable"
fi
The script ought to say ...
-1
votes
2
answers
92
views
Force sumif() with wildcard and fixed pattern
I have a Google spreadsheet with the following values:
+------------+-----------------------------+
| G | F |
+------------+-----------------------------+
| Hours (G)...
-2
votes
1
answer
87
views
How to access named capture groups in C++? [duplicate]
On Regex101, I have simple Regex with a named capture group in ECMAScript flavor:
(?<name>.*)
I'm trying to do the same thing in C++:
#include <iostream>
#include <regex>
using ...