The Stack Overflow podcast is back! Listen to an interview with our new CEO.

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
1
vote
1answer
12 views

Notepad ++ Insert at the beginning of nth line that contains a string

I am doing some Gcode machine instruction and I need to add an instruction in the beginning of the line where every 1st instance of F 180.0 but skip the second eg G00 X 0.0000 Y 0.0000 Z 10.0000 G00 ...
0
votes
2answers
40 views

Rename file and encapsulte last X number of charactors, before the extension, in square brackets

I've been using youtube-dl to download an entire youtuber's channel for archival purposes. I had been using the default naming pattern for naming the videos which uses the video's title, then a hyphen,...
-1
votes
0answers
19 views

Replace string with regex code Swift

I need to replace the words in a given string using Swift Regular Expression. Replace all words that are greater than 5 Ignore numbers (ex: 2000 or 2,000) But if a number contains characters ...
1
vote
1answer
19 views

Why is my regex code not returning any result?

Here is my code: import re word="ABCD 12345" match=re.search(r"\d*",word) print(match.group()) For this code, I am getting no output (no errors as well). Kindly help. What is the issue here?
0
votes
0answers
22 views

find filenames with non latin characters in their names

I want to find files with foreign filenames in them, I'm using a regex to find such files with another tool but I don't know how to use them in find. The system is FreeBSD so the find command is a ...
-1
votes
2answers
66 views

Insert a character after match with bash

I'm writing a bash script. I need to introduce a colon after the first occurrence of a character. /c/Users/ertwr/org/readme.html and in order to open them with the native Windows browser the need a ...
1
vote
2answers
63 views

Regex: Replacing single quotes but taking care of apostrophes

(I am certain that this question has already been asked, but I cannot find it.) I need to replace anything between single quotes with \enquote{}, the capture to be put inside the curly brackets. With ...
2
votes
2answers
51 views

Notepad++ Remove any commas past the sixth comma

I have a number of csv files that have differing numbers of commas per line in each of them. I would like to remove any commas past 6 in a line but if there are only 6 commas, then leave the line ...
1
vote
1answer
28 views

How to find exact opening closing (may be number of closing tags between) tags with content in it and replace in notepad++?

If I'm using regular expression to find exact open and close (even if there is enter mark), it will find only opening and closing tags regx: <del.*?</del> But is should find the below exact ...
1
vote
1answer
36 views

How do we achieve the following using replace function in notepad++

Transform Source: This is source 1 Description : This is the description of source 1 Source: This is source 2 Description : This is a description of source 2 into this: Description : This is a ...
3
votes
1answer
82 views

Batch File to Extract Text from the Middle of Log File Lines

In a UTF-16LE log file, I have lines like this: [128 characters]APP_NAME=Samsung Magician&APP_KEY=[additional characters]&APP_FLAG=[single digit] I want the APP_NAME (e.g., Samsung Magician) ...
0
votes
2answers
36 views

Use multiple conditions in find regex in shell

EDITED: I need to use -E for extended regex. I have a folder with this files (just an example): I'm trying to find all files that: Start and end with #. (e.g #hi.h#) End with ~. (e.g file.txt~) I ...
0
votes
1answer
46 views

batch file extract number from string using regex?

im running a command to get the version of a program. FOR /F "tokens=* USEBACKQ" %%F IN (`"%programpath%\bin\program" version`) DO ( set version_full=%%F ) the result: Program Final Type 6.6.8 (...
0
votes
1answer
52 views

How using sed on AIX differs from using it on linux

I know that -i option doesn't exist in sed for AIX but recently I've bumped into a different issue when trying to edit the /etc/services file in AIX. I need to replace a line from this file so for ...
1
vote
1answer
30 views

Using windows shell to modify the line after a specific line

I am trying to edit a line right after the line I am searching for. The file used is actually generated from parsing the registry.pol through the LGPO.exe. Here is the sample of the text file: ...
0
votes
0answers
15 views

KeePass Auto-Type regex not working

I configured KeePass Auto-Type to detect a certain login window (in a browser) using regex like this //^Webhosting - Login - Mozilla Firefox$// nevertheless, this matches (also) a page with the ...
1
vote
1answer
27 views

Regex: Delete words from ---comments section ---

I have in a blog many links starting with https://mywebsite.com. I want to delete those links (but before /story1.html, /story2.html, etc, from the particular comments section <!-- FLAGS1 --> &...
0
votes
1answer
19 views

Notepad++ Regex assistance needed - removing trailing garbage [duplicate]

I have a line in a log that looks like this: Customer-1234567', Site '001', TransferId: '123456789', Authenticated User: 'Customer-1234567|001' I need to remove all the trailing garbage and leave ...
0
votes
0answers
13 views

How to replace an online folder by local folder using Fiddler?

I'm struggling to make my browser fetch all files from local folder instead of all files from target online folder. I want to achieve it using Telerik Fiddler (which has relevant AutoResponder feature)...
0
votes
1answer
31 views

Notepad ++ How to remove text from the url

I've been trying this for an hour and can't seem to get the right regular expression any ideas? This: src="https://www.mywebsite.com/embedframe/84398934/need-this-text-and-the-forward-slash-before-...
0
votes
0answers
11 views

How can I use Regex to determine if a string has either a number, equation symbols, or a period in it?

I created this new custom console api while I was bored, and I created a feature which allows you to change a variables value. If your curious about the console api, heres a live pen: https://codepen....
0
votes
1answer
26 views

URL Pattern Matching in wget

The pages of a website I want to download all begin with a specific pattern of characters, like this: www.site.com/1234_1 www.site.com/1234_2 www.site.com/1234_3 et cetera. Is there a way to tell ...
1
vote
1answer
46 views

PowerShell - Replacing all occurrences, except one, of a certain character in a string

Writing a PS form in SAPIEN PS studio 2018. Problem: I have a random string, in text box, that contains square brackets in it ('[' or ']') Expected: Need to allow the user to type only one brackets ...
0
votes
1answer
41 views

How do I search for services that have a space in there name in PowerShell?

I am trying to get a list of services whose name contains a space, for example SQL Server services. To my surprise, the following statement does not return a single record. It seems that the space has ...
0
votes
0answers
32 views

regex for invoice amount omitting thousands delimiters

I need a regex to detect the total amount of invoices. Other amounts should be ignored. The problem is that the amounts do contain thousands delimiters which I need to remove from the result. For ...
0
votes
0answers
14 views

redirect a link to a subdomain in htaccess with regex

I Want To Redirect a Link To a Subdomain Link Like As Bellow: sample.com/seminar/details/3 to old.sample.com/seminar/details/3 What Should I Type In Htaccess File In Cpanel For Redirection? I ...
1
vote
2answers
77 views

Why does my regex not work?

I have several lines of phrases like The quick brown fox jumps over the lazy dog quick brown fox jumps over the lazy dog brown fox jumps over the lazy dog Now I want to select the rest of each line ...
0
votes
1answer
16 views

Wildcards - MS Word - Find replace entire line which has certain words

Saved emails from email extractor in text format. There are many 1000s of emails with 1 email per line. Some emails like [at]example.com and [at]mn.png must be removed from database/word file. How ...
0
votes
0answers
65 views

WIldcards in MS DOCX Find-Replace

I have long list of emails in docx. Each email/line. There are several xyz[at]example.com and xyz[at]xyz.png type entries. How to delete entire line/email by searching for .png and [at]example.com? ...
0
votes
1answer
49 views

Sublime regex replace for a specific character at the beginning of the word

I'm trying to remove character N starting at each multiple words. If you check the line below you will notice some words also have character N. For instance changing N'KISWAJKN' to 'KISWAJKN' (2019, ...
0
votes
0answers
15 views

Removing lines containing duplicate regex strings

I am sorry if this has been ask before but unfortunately there are so many questions about this kind of thing and although they are all related so many situations that apply to one instance may not ...
0
votes
1answer
62 views

How to correctly write regex to findstr for cmd?

I am trying to only print UUID in windows and running following command: wmic csproduct get uuid | findstr /R “[a-zA-Z0-9]{5}-[a-zA-Z0-9]{5}-[a-zA-Z0-9]{5}-[a-zA-Z0-9]{5}” Above command returns ...
0
votes
2answers
36 views

Regex String Number bash

I have this situation: $FILE_NAME = '207.Skyfall.2012.iTA-ENG.Bluray.1080p.x264.mkv' echo $FILE_NAME | sed 's/.[0-9].*//' | sed 's/\./ /g' Result empty the regex remove all if the file doesn't ...
1
vote
0answers
16 views

Creating multiple RDP sessions from HTML document

There is a website that lists data about hundreds of computers on our network in a table. This includes their IPs. I will routinely need to connect to these computers to do some troubleshooting, so I ...
0
votes
1answer
37 views

Monitoring/Centreon - SNMP Plugin command does not work with simple quote

I have a problem with one of my sonde (plugin) in Centreon. On my poller server, I launch this command: /usr/bin/perl /usr/lib/nagios/plugins/centreon-plugins-master/centreon_plugins.pl --plugin=os::...
13
votes
2answers
2k views

How do I find multiple values on the same line in any permutation using Notepad++?

I am using Notepad++, and I'm trying to find a way where I can search for multiple values on the same line. The regex search is not working for me currently, as I may not know which order the values ...
0
votes
1answer
33 views

Move files to folder using matching filename

I have doc, docx and PDF files wherein the filenames consist of a unique 9 digit number followed by text. I want to move those files to their respective folders which also consist of at least the ...
1
vote
1answer
41 views

How to implement “Does not Contain” or Negative Filter in Requestly

I am using Requestly Chrome & Firefox extension to setup Redirects. I have a use case in which I want to switch the host from say - www.a.com to www.b.com except when www.a.com has a specific path ...
1
vote
0answers
11 views

Consolidate paired list with regular expression

I've a list which I want to consolidate matching pairs: input: (A1, B1, C1) (A2, B2, C2) output: (A1 A2, B1 B2, C1 C2) I've tried expression like these: find: \((([^,]+)([, ]*))+\) \((([^,]+...
0
votes
3answers
52 views

Regex: Find all words separated by signs + - = (Search and Replace)

I have this scenario: data-cycle-center-horz=true other words data-cycle-caption=".custom-captions" other words data-cycle-caption-template="{{slideNum}} other words before words .data-cycle-...
1
vote
1answer
26 views

Are [^\s] and \S equivalent in regular expressions?

Are [^\s] and \S equivalent in canonic (widely accepted standards of) regular expressions? If not what is the difference? (Both seem to match any non-whitespace character.) Reason I ask: see [^\s] ...
0
votes
2answers
40 views

Bash - Rename all files that contain a given regex pattern

I have some files in a directory that that all contain either the string "HG-U133A", or "HG-U133B". I'd like to write a script that can go through all the files in the directory and rename all the "HG-...
1
vote
0answers
56 views

Colouring words in a PDF file (CLI)

I want to write a script to colour in red all words in a PDF file that start with the letter r/R. Here's an example: should become . The PDF displayed in the linked image was modified by ...
0
votes
0answers
22 views

How to have Regex Remove duplicate headers unsorted?

I am converting a html website into an ebook using Sigil. One project has 152 webpages added to a Sigil epub project. Some other projects will have thousands of entries.. (we are starting with a ...
0
votes
3answers
23 views

How can I remove lines that don't contain a number after “-” In Notepad++

How can I remove lines that don't contain a number after "-" In Notepad++ Example Value1-iiieoeiampl Value2-ah8e83e9e Value3-e9ASjdds9ja3 Value4-eoDJEjieee What I need Value2-ah8e83e9e Value3-...
0
votes
1answer
24 views

regex for extract number after word in a file with python

I have a txt file with the number of testcases passed and failed like below ****Tests Passed: 20 ****Tests Failed: 4 I want to capture the number for passed and failed and write it to another ...
0
votes
1answer
122 views

Kubernetes Nginx Controller Regex Rules Are Not Working

I am recently trying to build an Nginx Ingress network for my Kubernetes cluster. I am using Kubernetes 1.15.0 and Nginx 1.17.2 by the ingress controller image docker.io/nginx/nginx-ingress:alpine. ...
0
votes
1answer
15 views

Notepad++ split a line that starts with a string into rows on each space

I have some text that looks like this Read the following aloud Orange Mango Lemon Apple Read the following aloud red yellow blue white green black purple I need to split it to look like this Read ...
0
votes
2answers
40 views

Regex: How can I change the order of the lines after dot?

How can I change the order of the lines after dot with regex? Numai într-un context dăunător personal sau social poate fi descrisă transferul ca o problemă patologică. O perspectivă modernă, social-...
1
vote
2answers
56 views

Powershell Regex \d{n} Confusion

I'm messing around with simple regex filtering in Powershell, and I can't seem to get the digit \d expression to work properly. I have a Test Directory with multiple files using 2 naming conventions -...