Skip to main content

Questions tagged [regex]

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

-1 votes
0 answers
23 views

\G Token in Regex

I am trying to get a grip of \G token and struggling to understand its proper use. I went through some of the constructs using \G token and I am totally at a loss, how to use them, when to use them or ...
Shahid's user avatar
  • 97
-1 votes
1 answer
43 views

Add an underscore after numbers in Notepad++

I have a scenario where I have list with some numbers in Notepad++. Here is the sample text: 1-This is item one 2_This is item two 3This is item three 4_This is item five 5This is item six 6 This is ...
Shahid's user avatar
  • 97
0 votes
1 answer
46 views

Insert a char just before a particular set of words using Regex

I want to use GREP/Regex in Adobe InDesign. Following is the sample data: Rat: a mammal. Camel: an animal who lives in desert. An aeroplane: a machine that flys. The muddy water: water full of mud and ...
Shahid's user avatar
  • 97
1 vote
0 answers
19 views

Find regex pattern and use it in the next set of repeating lines until another like it replaces it

I'd like to find a pattern that rapeats every few sets of the second where I'd like to move it to. The only example I could think of right now is a file listing; but I've needed this so many times. ...
Vita's user avatar
  • 131
0 votes
1 answer
28 views

regexp multiple lines grep

I am looking for a correct regexp to return the first match and the new line. Let's say the logfile is like: Warning-[ABC] blablabla$ /path1/path2/path3/file The dollar at the end of the first line ...
Ste3191's user avatar
1 vote
3 answers
80 views

Which regex can I use to replace Greek capital vocals with tonos to ones without it, in Bulk Rename Utility application?

I would like to replace in a lot of filenames, the Greek capital vocals with tonos, with the ones without it: Ά > Α Έ > Ε Ή > Η Ί > Ι Ό > Ο Ύ > Υ Ώ > Ω I know how to replace them ...
geotso's user avatar
  • 23
0 votes
0 answers
25 views

Apple Numbers RegEx not working as expected (Negative lookahead)

RegEx.Extract Negative lookahead help needed due to what works in RegEx Support website does not work in Apple Numbers (?<=XYZ((?!\d+).)*)\d+ This is invoice from company XYZ - 1234545 product name ...
sit123's user avatar
  • 27
-1 votes
1 answer
20 views

regex to find non-price consecutive digits not immediately after certain word for Apple Numbers

0 How to find invoice number from different companies which may have different order of invoice number, unit cost and total cost? Following is specific example of a company XYZ which I need to get ...
sit123's user avatar
  • 27
0 votes
2 answers
51 views

adding quotes to set of comma separated IP addresses in notepad++

Please, I have a set of comma separated IP addresses and I want to add quotes to each IP addresses to that I can assign the set a powershell variable and parse each IP address strings in the variable ...
rmon's user avatar
  • 1
0 votes
2 answers
51 views

How to extract a text in between two patterns (potentially containing floating lookbehind) with only one invocation?

I'm trying to match any characters (except line break characters) in between xxx<1+ whitespaces>" and whitespace. The format of the input string is the following: xxx<1+ whitespaces>&...
pmor's user avatar
  • 346
0 votes
1 answer
45 views

Match a User That Starts With a Single Letter

I've been handed a script written by another and been asked to modify it according to their needs. There's one line that needs to be altered: if [ "$user" == "nobody" ] This ...
user2090974's user avatar
0 votes
2 answers
40 views

Notepad++ Regex search with characters before and after IP address

I have a huge file with text before and after many IP addresses. I'm trying to extract just the IP addresses that fall within x.x.x.x. The unique characters in the line look something like this: |SIP=...
AxelKong's user avatar
0 votes
2 answers
88 views

Using VS Find & Replace Regex across lines

I have multiple instances of code that looks like... if (condition) { statements } else if (different condition) { statements } ad nauseum (probably, honestly about 100+ different times, and ...
Musical Coder's user avatar
-1 votes
1 answer
61 views

Custom Fail2Ban regex not working as expected

Using the regex filter below: [Definition] failregex = ^<HOST>.*Priority: 0 ignoreregex = Fail2Ban does not detect any of these log entries below. Mon Apr 1 21:11:29 2024 [**] [1:1000002:1] ...
nexdev's user avatar
  • 13
-1 votes
1 answer
77 views

Search and replace doesn't work with sed busybox. getting sed: unmatched '/' error

I am trying to search a particular string and replace all occurrences within a file. sed -i -e "s/$search_string/$replace_string/g" $filePath I keep getting sed: unmatched '/'error on ...
aelor's user avatar
  • 99
0 votes
3 answers
50 views

Powershell $idValue doesn't write the extracted ID, but writes "TRUE" instead -- why?

I am writing a Windows PowerShell script to split a text file based on a delimiter, and create output filenames with an incrementing number and a captured identifier string. I've checked for syntax ...
IanS's user avatar
  • 183
2 votes
1 answer
43 views

Replace text surrounding a wildcard in Notepad++

So, many years ago when I started writing PHP code, I learned to format information sent from a form as such: $_POST[itemnamehere]; Whether that was right or wrong at the time, it worked. However, ...
teddytash's user avatar
0 votes
0 answers
50 views

Passing `Set /p _var=/irc:` when used by findstr, the colon does not get processed the same as if I typed `findstr /irc:` Example provided

I have search through the undocumented 'findstr' thread, SS64 findstr-escapes as well as SS64, Escape Characters for how to include the colon in the following way; no luck with either. Example batch ...
query-01's user avatar
1 vote
1 answer
25 views

RegEx replacement in NotePad++

I need to replace many different lines in a html file where lines look like this: <span lang="en-ca">random string</span> with just random string For example my<span lang=&...
Rob's user avatar
  • 536
0 votes
0 answers
23 views

windows-equivalent of mac's "insert pattern" functionality for {find,search}ing/replacing text

surprised no one has asked this question yet. is there any way to get the "insert pattern" functionality that is available on pretty much all mac apps with search and replace (except, ...
gagan's user avatar
  • 1
2 votes
1 answer
98 views

In Notepad++/Sublime Text 3, how do I make all text lowercase by regex, but only if specific phrase occured in the line?

Say I have text like that: models/players/clonespac/CloneTorsoLieutenant { q3map_nolightmap q3map_onlyvertexlighting { map models/players/clonespac/CloneTorsoLieutenant ...
kerstoff0mega's user avatar
0 votes
1 answer
68 views

Select last 5 words of a paragraph in Regex

I want to match last 5 words of every paragraph in a document. I am using Notepad++ and also Adobe InDesign GREP Sample Data Here you can find activities to practise your reading skills. Reading will ...
Shahid's user avatar
  • 97
0 votes
0 answers
29 views

rstrip On Lines of text being piped through sed s

So I am trying to implement the rstrip function on lines of text being piped into sed s and am having troubles. This is what I have that I think should work: cat file1.txt | sed 's/[[:blank:]]+$//g;' &...
Alan Sanchez's user avatar
0 votes
1 answer
43 views

Notepad++ Regex merged 2 sections into one line delimited

I hope I can explain correctly. I have the text below, which consists of 2 sections, 1- the body and 2- the title and each one is separated by a "----" delimited. I am able to mark this data ...
robert's user avatar
  • 1
1 vote
0 answers
94 views

Replace ** to NULL in Excel

I have excel which contain ** as value along with other values across between Rows and Column. I'm trying to replace ** with NULL but using Find & Replace it's Replacing everything as it's taking *...
pkd's user avatar
  • 145
0 votes
1 answer
78 views

remove duplicate character from string in pure bash - works in CLI but does not work in script

I want to remove all duplicate minuses from a string using pure bash (no sed/awk/etc). This works great in CLI: s="com---strig-3-1080p-----mp4" echo "${s//+(-)/-}" com-strig-3-...
Putnik's user avatar
  • 924
0 votes
1 answer
297 views

Select all lines starting with a given string and ending with " with Regex [duplicate]

Using Regex I would like to select all the contents between two " of all the lines that begin with this string: [2] 1 string data = " I tried the following code: (?<=\[2\][^=]+? 1 ...
Kenryoku's user avatar
-1 votes
1 answer
45 views

How to match arbitrary adjacent identical strings? [closed]

There are some repeating strings in my data that I need to find. They have a pattern that they repeat twice, and the repetitions are adjacent, with no space in between. They can have arbitrary lengths ...
Vegetable New Man's user avatar
0 votes
2 answers
82 views

Find and replace date with UTC date

I have file that looks like this: [2024-01-20 15:23:00] hello world [2024-01-20 15:42:00] bye [2024-01-20 15:43:00] foo bar ... Date in this file are in UTC+1 and I want to convert in to UTC I tried ...
sloppy's user avatar
  • 3
0 votes
0 answers
101 views

How to recursively search for files starting with ".#" under a path in zsh?

In the current working directory, la -a returns, . .#program 2.py .DS_Store picker.py .#picker 2.py .#program 3.py hw1 temp.test .#picker.py .. hw2 I ...
scribe's user avatar
  • 206
3 votes
3 answers
656 views

Bash [[ test =~ regex ]] vs perl command result

Is the bash operator =~ equivalent to a perl invocation? filename="test-33.csv" regex="([^.]+)(-\d{1,5})(\.csv)" With bash test: if [[ "$filename" =~ $regex ]]; then ...
rellampec's user avatar
  • 133
1 vote
2 answers
365 views

How to use the `tax[13]-eq-dc` regex in a Bash loop?

The following regex tax[13]-eq-dc represents two servers, tax1-eq-dc and tax3-eq-dc. I'm trying to find a way to use it in a Bash do loop, but can't just get the correct syntax. E.g., the following is ...
boardrider's user avatar
  • 1,153
3 votes
1 answer
130 views

Surfingkeys browser extension has enabled, disabled, and lurk mode. How do I add a list of websites in surfingkeys to browse in the lurk mode?

Lurk mode is better than disabling suringkeys altogether. For example, Gmail website has list of abundant shortcuts, but still it's better to have surfingkeys' shortcuts as yourbackup. In lurkmode you ...
souraj ghosh's user avatar
1 vote
1 answer
374 views

Trying to use regex to match the "?si=" on YouTube share links

I want to match the ?si= on the end of YouTube links using Regex so that I can filter submitted links to remove the ?si= and what comes after. I want to exclusively match that ID, and not anything ...
SamHammie's user avatar
0 votes
1 answer
122 views

RegEx in Microsoft Word Find/Replace to locate an unescaped semi-colon in index markers

I've got Find/Replace open, under More I have Use wildcards checked. I have a LOT of index markers in my document, and I want to find semicolons inside the index markers that are NOT escaped. I want ...
Christie Ward's user avatar
1 vote
1 answer
80 views

Regex code for TeamSpeak3 ControlBot plugin

I want a code that doesn't kick Name_Surname but kicks anything else. My current code is : ^(?![A-Z][a-z]+(?:_[A-Z][a-z]+)*).*$ I need one more rule to add to this code. I want to allow [C]...
Enis's user avatar
  • 11
0 votes
1 answer
155 views

How do I find and delete a string at end of a line?

I have lines with this kind of data: SEQ 338 13 OPS POSN 1 THRU 10 LANG KO 3 MO TU WE TH FR SA SU ---------------------------------------------------------------------------- SEQ 339 6 OPS POSN 1 ...
Jeff Taylor's user avatar
1 vote
1 answer
375 views

RegEx to find TEXT plus up to 6 numbers

[Using Notepad **] Seeking a RegEx to find all of the following lines that contains the word "SEQ", a space, and then anywhere from 3 to 6 digits: SEQ 123 SEQ 1234 SEQ 12345 SEQ 123456 I've ...
Jeff Taylor's user avatar
1 vote
1 answer
145 views

If the Account has Expired, Delete the Account Details

What regular expression would I need to delete all the expired accounts. Name: John Smith Address: 123 Sample Road Country: England Membership Expires: January 26, 2023, 9:35 am -288 Days Plan: ...
Frank's user avatar
  • 57
3 votes
2 answers
434 views

Extract text between the Tags

I am trying to extract Arabic text between the two tags. Here its <Content>some text in arabic</Content> Sample Text: <idPkg:Story xmlns:idPkg="http://ns.adobe.com/AdobeInDesign/...
Shahid's user avatar
  • 97
0 votes
1 answer
83 views

For eliminate the lines with Duplicate URLs at the beginning of the line

Before: https://en.wikipedia.org/wiki/Led_Zeppelin - Led Zeppelin - Stairway To Heaven 2 https://en.wikipedia.org/wiki/Led_Zeppelin - Led Zeppelin - Stairway To Heaven 1 https://en.wikipedia.org/...
Gouraya4912's user avatar
1 vote
2 answers
85 views

How do I Write a RegEx that will Edit Only Very Specific Data

I'm trying to write a regular expression that will find data scattered throughout several files that look something like this: [Something here](HTTP://somesite.com) [DifferentStuff](HTTPS://Another....
Ken's user avatar
  • 11
1 vote
1 answer
401 views

Powershell rename-item using RegEx for filename irregular pattern

I have filenames in a directory that have different beginning strings of characters that I wish to strip out and leave just the alpha characters + file extension: [example] 1-09. But Not for Me.mp3 1-...
Jeff Taylor's user avatar
0 votes
2 answers
504 views

RegEx Notepad++ Search and Extract

I am looking for the RegEx search string to extract a specific entry in a single row. Example is {"version":"264599-1-0","exportPath":"Site Management/Site Set-up/...
Quentin Lynn's user avatar
2 votes
2 answers
320 views

I want to get every command that has 3 letters and only three letters

I don't get the output I expect using apropos -k . |awk '/^.../ {print $1}' am I completely overthinking this? In this sample output only zsh should have come back. I also tried this apropos -k . | ...
Mark Scheck's user avatar
0 votes
2 answers
89 views

Replace blocks of numbers: </2645>

I have a file in Notepad++ that was converted from a PDF. I've managed to sanitise loads of nasty glitches with regex but this one escapes me. Blocks of numbers like these: </2478><2479> &...
NICKINNK's user avatar
1 vote
1 answer
32 views

What is the purpose of the |$ within quotes in the following command?

openssl x509 -in cacert.pem -noout -text | grep -Ei ".*public.*|$" | less -Rx How does this command filter the information in bold? Technical College, CN = Jim's Root CA **Subject Public ...
Johnny Garcia's user avatar
0 votes
1 answer
82 views

Delete all except matched items

I want to delete all the data except matched items from my file. I am using Notepad++ I want to keep everything between <w:t> and </w:t> tags delete rest of the matter. Sample data: <?...
Shahid's user avatar
  • 97
0 votes
1 answer
760 views

Regex to find more than one occurrence in GrepWin

I want to find more than one occurrence of the tag h1 in multiples files. The following regex brings files that has it more than 2 times, which is working great: /(h1.*){2}/ However, what if I want ...
Mike's user avatar
  • 377
1 vote
1 answer
548 views

How to test if a cell matches given REGEX in LibreOffice Calc?

I have a cell, and I want to test if it passes a specific pattern: 3-4 alphanumeric, minus, 3-4 alphanumeric, minus, 4 digits, minus, 1 or more digits. In other words, I want "TEST-TST-1234-33&...
v010dya's user avatar
  • 216

15 30 50 per page
1
2 3 4 5
43