Questions tagged [regex]
Also known as regular expression or regexp, a description of a set of strings, often used for searching and validating strings.
2,152 questions
-2
votes
1
answer
38
views
How use vim substitute() to strip non-alphabetics from either end of a word
Using vim 9.1 on Lubuntu 24.04
Suppose @" contains " Jcouldn't, ". I have tried a variety of regexes to reduce @" to Jcouldn't, including
echo substitute(@","^\A*\(\u\l\+'...
-1
votes
3
answers
168
views
Replace some symbols and text in cell and leave the rest
I'm doing a project using LIbreOffice 25.2.3.2 on a MacBook Air which is running OS Sequoia 15.6.1.
I have a spreadsheet in which U.S. states are assigned a region. It looks like this:
What would be ...
1
vote
1
answer
535
views
regex for matching after pattern in vim
I'm trying to come with a regex that search for every word after enum and before braces {} in vim.
enum CONSTANTS{
.....
};
I try /\<enum\>\=.*[^{] and search for patterns from enum to next {. ...
2
votes
2
answers
242
views
bash regex: match a word or its plural
bash 4.4.20
$ echo $X
(6 rows)
[[ $X =~ row\)$|rows\)$ ]] && echo matches
matches
That works, but is redundant. Is there a way to isolate the \) and s\), so as to say "match row + ')' ...
0
votes
3
answers
207
views
Microsoft Word Expression to Find Continuous Sequence of Characters
What works in an online tester or NotePad++ does not work in Word. Word either finds nothing or two characters, not what it should. I have Use Wildcards as the only item checked.
Say:
Happy 123(456)-....
-3
votes
1
answer
186
views
I need Regex to match numbers like: 1740472449653-61294_left.7z , 1740472440074-16363_found.7z
In short, I need to match the whole number with 7z, gz, and txt.
Here are some examples:
1740329420285-105653_left_hpwn.7z
1740314283864-left_0.7z
1740901975709-found_0.txt
1740314283864-left_0.7z
...
1
vote
1
answer
179
views
Regex Pattern to find 2nd match
I created a powershell script to do certain tasks for our sales/finance department.
Our system creates a large PDF file with several pages where each page is one invoice.
The PDF file needs to be ...
2
votes
0
answers
90
views
How to set mod_rewrite in an .htaccess on Apache to move folders out of parent folder up to the root?
On a WordPress site, I'm trying to move five subfolders and all their contents (about eighty pages in all) up one level in the tree, so that each subfolder becomes a folder off the root.
From this:
...
3
votes
4
answers
373
views
How to extract one part of a paragraph if a previous line matches an expression?
I’m trying to get the time delta value for a given host (I have either its hostname or IP address) from the following text:
--------------------------------------------------------------
CentMgmt::...
3
votes
1
answer
269
views
Remove the first forward slash from string with Notepad++
I need to remove the first leading slash in the html file.
For example
/2019/02/25/some-article-here
turns just into
2019/02/25/some-article-here
Exactly as posted here, but with Notepad++ only. A ...
1
vote
1
answer
102
views
Notepad++ Regex pattern issue (valid on online regex testers)
I have the below pattern:
\".*\\(.+)[\r\n]?(.*)\"
Being applied against the following text:
"c:\users\jdoe\OneDrive\Folder 1\Folder 2\File 1.pdf
File 1.pdf"
"c:\users\jdoe\...
0
votes
0
answers
95
views
Regex in VS Code with VBA modules
I'd like to figure out how, using regex in VS Code, to replace within a matched string. For example, with the following text:
Public Sub Name()
Line 1
Line 2
Line 3
End Sub
I'd like ...
0
votes
1
answer
81
views
How to highlight text present in the last parenthesis and first colon from start with grep in Adobe InDesign?
I am using Adobe InDesign. I want to apply character style named bold using grep styles/nested styles but only until the first : from the start and last parenthesis.
The grep I am using is making all ...
0
votes
0
answers
62
views
In Adobe InCopy, why does a GREP search with a negative lookbehind for a paragraph start find only the first occurence in the paragraph?
I am working in Adobe InCopy and need to find a particular sequence except when it appears at the start of a paragraph. To do this I am using the following GREP/regex pattern: (?<!^)x. (This is not ...
1
vote
1
answer
88
views
How to split multiline text and include white spaces before the split word with PoweShell?
I'm trying to split a multiline text by a word. The problem is that -split "(?=Name\s*:)" will not include white spaces before the 'Name'. "(?=\s*Name\s*:)" will split empty lines, ...