Questions tagged [regex]

Also known as regular expression or regexp, a description of a set of strings, often used for searching and validating strings.

Filter by
Sorted by
Tagged with
0 votes
1 answer
25 views

How to reduce font size for all images, dates and times in Microsoft MHT document?

How to easily, non-programming, non-third-party way to reduce size of all: dates and time Images Headers Doing so helps those read essential information within MHT document from Steps Recorder. As ...
panes-rubrics's user avatar
0 votes
1 answer
47 views

How do I search for and keep only a series of duplicate words in Notepad++?

I have a long .txt file, here's a sample: A Beautiful Mind (Howard, 2001) Blu-ray, RIP, 1080p, x264, AC3 ITA-ENG, Subs, MKV, 12.26 A Bigger Splash (Guadagnino, 2015) Blu-ray, RIP, 1080p, x264, DTS ...
maudit's user avatar
  • 13
0 votes
1 answer
38 views

Does Microsoft word have wildcards for return (\r) & new line (\n) like Grep or Regex do?

I frequently want to replace multiple consecutive return characters in written documents with a single return character and to use paragraph space (space after) to do the formatting. Sometimes there ...
wide_eyed_pupil's user avatar
-1 votes
3 answers
45 views

Notepad++ - how to remove file prefixes?

In the following playlist, I want to basically delete all digitdigit- occurrences. For example, 02-Never becomes Never and 04-Thriller becomes Thriller. And I have other playlists that are over 300 ...
Dennis's user avatar
  • 1
0 votes
1 answer
12 views

regexp in perl fails

Why is this failing? WGroleau@MBP Chords % perl -p -i -e '(Trinidad|Donoso|Clifton|Frincke|Little|Church|Antonio) XYZ :\1\t:g;' *txt Bareword found where operator expected at -e line 1, near ") ...
WGroleau's user avatar
  • 715
0 votes
2 answers
31 views

Regex: Find all words that starts with `un|unui|o|unei` follow by any words, but after that words have the connecting element `de`

I want to find a regex formula, as to find all words that starts with un|unui|o|unei follow by any words, but after that words have the connecting element "de" unui model de amintire un ...
Just Me's user avatar
  • 804
1 vote
2 answers
48 views

Find text between parentheses and delete rest

I have paragraphs like this: (قَوْلُهُ: وَمَسْحُ الرَّأْسِ) إنَّمَا أَخَّرَهُ؛ لِأَنَّهُ مَمْسُوحٌ وَالْأَعْضَاءُ مَغْسُولَةٌ فَلَمَّا كَانَتْ مُتَّفِقَةً فِي الْغَسْلِ جَمَعَ بَيْنَهَا فِي الذِّكْرِ....
Shahid's user avatar
  • 53
0 votes
2 answers
74 views

How to Replace several words in one string in Notepad++

I need to replace several different specific words/values in one string, for example: 1), 2), 3), A., B., C., etc. They can all be replaced with the same thing - nothing, i.e. no value entered into ...
Mike M's user avatar
  • 3
1 vote
2 answers
25 views

Cannot find the correct Regex solution

I have content that looks like this: 001 B OR 06K24b 01 TCP SC C 02 001 B CC 12K48b 99 BCP SC A 02 1982-11-09 001 B OR 06K24b 01 TCP SC C 02 I want my regex expression to match line 2 but not line 1 ...
Brian's user avatar
  • 556
0 votes
1 answer
26 views

Regex: Replace empty space with a dash between the words, on canonical html tag

I have this canonical link, but if you look well, there are some empty space on the html link. Those empty space I must replace it with a dash <link rel="canonical" href="https://...
Just Me's user avatar
  • 804
-3 votes
1 answer
24 views

Regex: Find those words that doesn't have html tags on line, and add tags before and after

I have these 3 lines. The words in the second line are missing html tags. <p class="mb-40px">ARTICOL START</p> ARTICOL START <p class="mb-40px">ARTICOL START</...
Just Me's user avatar
  • 804
0 votes
1 answer
30 views

How can I find the next following line containing a specific string, then append that to the current line? (Notepad++)

I'm trying to search through text in Notepad++ for certain "line pairs" (lineA, lineB) to concatenate them and discard anything else. Each Line Pair lineA must contain a comma lineB is the ...
dakim's user avatar
  • 3
0 votes
3 answers
29 views

Regex: Put the content of mutiple html tags into a single html tag

<p class="mb-40px">Decisive too, of <p class="mb-40px">otherwise, it was the opportunity to <p class="mb-40px">acquire what were to be two pillars <p ...
Just Me's user avatar
  • 804
0 votes
1 answer
13 views

Regex: Add html link to another html link in the same html tag (Double the html Link)

I have this html class with a html links inside. The problem is not clickable on mouse over. So, I want to make it clickable. <p class="mb-40px"><strong>* Surs&#259;:</...
Just Me's user avatar
  • 804
-2 votes
3 answers
39 views

Regex: Select and delete all lines between 2 points

I want to delete all those lines that starts with <script type="application/ld+json"> and ends with </script> For example: <script type="application/ld+json"> { &...
Just Me's user avatar
  • 804
0 votes
2 answers
123 views

Replace between brackets content sublime & regex

I've actually got lines like this: [Sat Dec 31 18:24:18.700 2022] 0.017 sec 0.017 sec [all/2/rel 37 (0,700) @groupparentid] [post]keyword How can I delete the whole line starting with bracket [ and ...
Nass's user avatar
  • 1
3 votes
1 answer
95 views

Notepad++ Delete Multiple Lines with Find in Files

I want to delete the whole line that contains certain words such as: build, name, disk. I know that there is a search string ^.*?build.*$(\R|\Z) which will find lines containing "build" How ...
wikisP's user avatar
  • 33
0 votes
1 answer
57 views

Regex that will only match in filenames

I need a regex that will only match whatever is in the filename even when I give it the whole path, for example matching for x64 and nono: x64/x64/x64/lol/me.me <- will NOT match nono.meme <- ...
LUKISO2's user avatar
0 votes
3 answers
1k views

How to remove extra space (nbsp) at the of every line in Notepad++

So I have received this film script which has one or two extra spaces at the end of every line. I want to remove extra space from the end of every line in notepadd++ but keep the spaces between the ...
Abhinandan Gadge's user avatar
0 votes
1 answer
43 views

AWK: "invalid regexp: Invalid collation character" -- how do I make it valid?

I have an awk script that must process millions of records, but I need to remove any containing a multibyte character. In one environment where I work, the following simplified shell sequence ...
Kyle Banerjee's user avatar
0 votes
1 answer
314 views

Matching exact word with special character

How can I match a word like @hello# without catching the word @hello#1? I have tried the \\b@hello#\\b word container but will not work with the special characters.
Gravity123's user avatar
0 votes
2 answers
95 views

Use PCRE2 Regex to group phrase before colon AND group comma separated values

I have what seems to be a simple task but isn't working for me. Using only PCRE2 Regex (nothing else), I am trying to collect a phrase before the first colon at the beginning of a line, then separate ...
Tushar Bhutt's user avatar
2 votes
1 answer
184 views

Use REGEX only to group multiple key value pairs on line with anchoring text?

TL;DR: How can I grab a series of key:value pairs that are comma separated, but only if they start with specific strings? Hello, I have a situation where I have a block of text with multiple lines, ...
Tushar Bhutt's user avatar
0 votes
1 answer
67 views

Regex filter the value and show less than required number

We have the docker tags with below versions, please help to share the regex pattern to filter the records that is older than below values for example should show old tags = 23.0.0.17 and older, 23.0....
hare krshn's user avatar
0 votes
1 answer
21 views

Regex: Delete the contents of all files that start, the first line, with the word ETICHETE:

I want to use Regex to delete the contents of all files that start with the word ETICHETE: For example, all my files starts, the first line, like this: Eticheta: Semifinala GBOB Crisana - Revista De ...
Rob Rob's user avatar
  • 111
0 votes
1 answer
71 views

Notepad++ move first two characters to end of line

I have a list of Country Codes in the following format: US:United States I'm trying to replace it with United States:US I've moved the semi-colon to the end by searching for ^(.*)\b:\b(.*)$ and ...
Junky's user avatar
  • 135
0 votes
0 answers
127 views

How do I detect nul (0x00) characters in a vim string or register?

I have a vim register that contains a string. I need to step through each character in the string, and process each one individually. My problem is that given a character pulled from the string, I am ...
Rich88's user avatar
  • 1
-1 votes
1 answer
58 views

I want to find one user using regex from the text file which is in json like format. Find the user with regex and remove it with surrounding text

Find the user from the below text (highlighted "testUser") define name{ name **testUser** aliasName Test User ...
Cdarji's user avatar
  • 9
1 vote
1 answer
34 views

Invert order of lines by the pair

I have the following structure: Down: This should be down 1 Up: This should be up 1 Down: This should be down 2 Up: This should be up 2 Down: This should be down 3 Up: This should be up 3 Down: ...
triplosete's user avatar
1 vote
1 answer
146 views

Using REGEX only, copy last (delimited) word to every comma separated value?

I have a series of lines with arbitrary number of comma separated values, and then a hash marked comment. The challenge is, using only PCRE2 regex for use in PERL, to do the following: Store the ...
Tushar Bhutt's user avatar
2 votes
2 answers
127 views

Search 16 digits number and replace 7th to 12th digits with x

How to use Notepad++ regular expression to replace the 7th to 12th position of the found 16-digits numeric string in a text file with "x" ? Example of numeric string to search: ...
Sylvester's user avatar
0 votes
1 answer
91 views

grepWin: Is it possible to use Regex in search path(s)

Regex is allowed in the "Search For" and "File Names match" fields in grepWin. I would also like to use regex to specify the list of paths in the "Search in" field. Is ...
Joel's user avatar
  • 1
0 votes
1 answer
216 views

How to delete a line based on a regex string in Powershell?

I want to validate if the line above a certain line is there, then ok. if else, then delete that line and remove the empty space ? Can this be done in powershell? please help If before all lines ...
coder234's user avatar
0 votes
1 answer
290 views

Find and replace text in a file only after 2 different patterns match using `sed` or `awk`

This is an extension of the question asked-and-answered here: Find and replace text in a file after match of pattern only for first occurrence using sed The problem being: I need to perform a find-and-...
OneCheapDrunk's user avatar
0 votes
1 answer
372 views

How to replace the last space in a line with '|' character in Notepad++

I couldn't find any sample question that solves my problem in Notepad++. I have a string of n words in the following format in a Notepad++ text file: Word_1<**space_1**>words_with_spaces&...
Narayan's user avatar
1 vote
1 answer
89 views

How to use Find/Replace Wildcard on Word?

I made a mistake on a huge word document (100 pages) and I would to fix it quickly using the wildcard. I tried to use many different options but could not find the right command to use. Example on my ...
killua's user avatar
  • 29
0 votes
1 answer
36 views

Combine lines whenever string matches in the first field

Combine lines with matching first field I have a long text file which consists of lines in the following format: Groub 1 any|word،some other word،more word any word|word2،other word،more word،more any ...
amr's user avatar
  • 1
-1 votes
1 answer
156 views

Filter out nodes of an xml tree that have an empty tag, and some elements have line wraps sometimes

How to get only the nodes that do not have an empty <sometimes_empty_tag>? Taking just a snippet of an xml to play around with, the one to be dropped is the first of the nodes with its empty <...
questionto42's user avatar
  • 1,705
1 vote
1 answer
38 views

Get CSV from 2 patterns and ignoring all the rest

There's a pattern that starts the same but is a little different as it ends, one continues on the beginning then I want to keep the line remainder, the other I want to keep right away but before the ...
DynV's user avatar
  • 57
1 vote
3 answers
97 views

How to extract specific text from notepad ++

I have a log file that I need to extract specific data elements from. Example text: [22-12-20 21:16:04.521] FROM LIVE <$011B4B50:FleetCard_10:1,51.75,1,1,200001,Fleet No,5411,34319,TARJETA,,51....
aryan's user avatar
  • 13
0 votes
0 answers
45 views

Having an issue with GUID matching NGINX Expression in Location

Trying to write a REGEX that would match the following URI in NGINX: /run-7d99e660-c9fe-11e8-a8d5-f2801f1b9fd1/ or any variation of that. However, I keep getting 404 when attempting to navigate to it. ...
Val's user avatar
  • 101
1 vote
1 answer
32 views

RegEx to replace certain text in Notepad++

I have text from chats containing 200.000+ lines in format like this: [21-Nov-22 04:49 PM] VillagerA Hi [21-Nov-22 04:50 PM] VillagerB Hello [21-Nov-22 04:50 PM] VillagerA Hi again [21-Nov-22 04:51 ...
Daphne1ia's user avatar
0 votes
1 answer
71 views

Word VBA Regex replacement text inserted to wrong place

I have a Word template with a macro that makes text replacements. But it pastes the replacement text to the wrong place. However, using the Word Search/Replace function manually (Ctrl + H; "Use ...
Johnnygirl's user avatar
2 votes
1 answer
510 views

RegEx: Replace all lines ending with specific text

Say I have the following text: 1 AM_TESTING 2 AM_TEST 3 something else 4 some text AM_TESTING 5 some text AM_TESTING new text Using Notepad++ (or any other editor with regex support), I'd like to ...
AlainD's user avatar
  • 4,337
0 votes
1 answer
289 views

replace word only if string contains - Notepad++

Need to replace the word "html" with "jpg" only in the lines that contain "_%7bwidth%7d" Used ^(.*_%7bwidth%7d.*)html as per https://stackoverflow.com/questions/37685633/...
alex's user avatar
  • 1
1 vote
1 answer
37 views

sed in bash: '-n' as input is treated differently?

I'm struggling with a problem with sed in bash which occurs both on macOS and Ubuntu. During a long debugging session I pinpointed it down to this minimal example: echo "abcde" | sed 's/.*/x/...
RocketNuts's user avatar
  • 1,002
1 vote
1 answer
28 views

perl extended regex pattern with (condition) behaves wrong, what I do false?

I use perl --version perl 5, version 36, subversion 0 (v5.36.0) built for i686-linux-gnu-thread-multi-64int (with 52 registered patches I have used following test lines with these results: perl -we '$...
Anton Wessel's user avatar
0 votes
0 answers
43 views

grep with -P (=PCRE) and ext regex pattern (?(cond)yes-pat) does output line despite non-match, what do I wrong?

I am using grep version grep (GMU grep) 3.0 and I have tried following test code with these results: echo "ab" | grep -P '(?<=a)b'; WE_retcod=$? yields ab (b is colored) retcode is 0 ok ...
Anton Wessel's user avatar
2 votes
1 answer
441 views

Bash find using regex fails with digit matching

I'm using find (GNU findutils) 4.7.0 with GNU bash, version 5.0.17. touch hello.32.world.txt find . # works, output is: ./hello.32.world.txt find . -regextype posix-extended -regex '.*hello\.32\.world\...
Andrew Parks's user avatar
0 votes
2 answers
38 views

Regex: Make search and replace up to a certain point (up to a certain line from paragraph)

So, I have this text. I need to use regex as to change the word however, and replace it with (empty space) The big problem is that I want to make the replacement in all text, but only those ...
Hellena Crainicu's user avatar

1
2 3 4 5
41