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

learn more… | top users | synonyms (1)

2
votes
1answer
54 views

Remove spaces at beginning of line if first non-space character is a letter (Notepad++)

I am using Notepad++ to cleanup some wiki code and would like to do the following: I need to remove all leading spaces from a line but only if the first non-space character is a letter. Here's an ...
6
votes
5answers
13k views

How to use Notepad++ to find files in a directory that do not contain string

Does anyone know a quick and easy way to use Notepad++'s "find in files" (or other feature) to find files that do not contain a string? For example: List all files in c:\inetpub\mywebsite that do ...
2
votes
2answers
1k views

Regex search in text editors UltraEdit or Notepad++

I would like to find the above code and replace with my own code. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <...
1
vote
3answers
94 views

Notepad++ Regex to replace the 4th character of each line in a text file.

I have a large text file and want to replace the 4th character of each line. Cloud you please suggest a Regex to do that in Notepad++?
0
votes
1answer
92 views

Regular Expression - Where string contains 'bar' but is not preceded by 'foo'

I currently have a regular expression to match where a string contains 'bar' but is not preceded by 'foo': (?<!foo)bar I wish to modify the regex to match where a string contains 'bar' but is ...
0
votes
1answer
2k views

Multiline find and replace wrapper with wildcard inside

I'm trying to put a wrapper around a bunch of fields that already exist. I want to convert this: <div class="editor-label"> @Html.LabelFor(Function(model) model.FirstName) </div> &...
0
votes
1answer
46 views

How to match a word followed by anything in Notepad++

I want to enclose the first word with brackets and the "anything" that follows after the space by brackets too. Unfortunately the command : (\w) (.*) doesn't work. For example, for the sentence "How ...
1
vote
0answers
142 views

Sublime Text: Why regex in syntax highlighting does not work?

In Sublime Text 3, a default syntax highlighting rule paints a SQL SELECT just fine if it's in the same line, but not if it's in the next line: vs After reading this question I opened the PHP ...
1
vote
1answer
39 views

Assistance with RegEx in Word

I have a Word 2010 document containing a list of blocks with predifined styles. The styles are used in another software to process these blocks. I created the document using a wrong quickpart so all ...
6
votes
7answers
24k views

Regex Replace from Command line

Is it possible to regex replace from command line? Right now I'm using notepad++ to do this. In command line I can only use FINDSTR wich can only locate the mached files/lines EDIT : Maybe it will be ...
2
votes
1answer
34 views

sed, regex replace with vars

I'm trying to use sed (4.2.2-4+b1 debian 8 (jessie)) to replace text in multiple files. To go from this: $var1 = array(foo=>"bar",bar=>"foo"); $var2 = array( foo=>"bar", bar=>"foo" ); $...
1
vote
2answers
993 views

Regex append a string to a part of the match

I find this quite hard to do, the thing is as follows: I have a string in the form: GlobalParameters::$docId = DocList::$PARTNERS; And I want to append the string _VIEW to the end of the symbol. ...
2
votes
1answer
194 views

Remove trailing whitespace at the end of table cells

I have opened a PDF file in Word in order to edit it (the original Word document is lost). During the conversion, each line of text and each table cell was given an extra space. Of course, they don't ...
1
vote
1answer
41 views

Replace returns wrong capturing group

I have a text file that looks something like this: ,'','a','bc','def','ghi','lmn','op','qr','stu' I'm trying to replace groups of 5 with the match and a line break for easy readability. So, I'm ...
0
votes
1answer
22 views

How to extract only a part of a string

I have a batch file using wget and grep that downloads a website, and then extracts the fallowing string from the source code. <p>11.59 €</p> As you can see, grep included the paragraph ...
0
votes
3answers
104 views

How to extract the first N words of each paragraph in a text? [closed]

Could you please tell me how could I extract the first N (e.g. 30) words of each paragraph in a text? Maybe with a regex?
0
votes
0answers
8 views

Is there any way to keep “Regular Expressions” checked by default in TextMate?

When I use the find/replace dialogue in TextMate2, 95% of the time I want the regular expression behavior. However, every time I restart TextMate, it defaults back to leaving it unchecked. It also ...
0
votes
3answers
26 views

Use of the “OR” Regex operator with the find command

There are so many of these questions on the net, but I was unable to solve this simple problem. I have a directory with a lot of images, but I only want to copy a subset of them identified by ranges ...
0
votes
1answer
22 views

Regex directory renaming

I'm not great with regex and can't figure out why this is selecting the next character after the - /[\-][^ - ]/g with that, it selects - and the following character. I want to select the dash ...
33
votes
7answers
15k views

How to run a regex search on Google Chrome or Firefox?

How can I search for expressions like 'foo|bar' on webpages using browsers like Google Chrome or Firefox?
0
votes
1answer
46 views

Notepad++ or Vim Document Wrap or Text File Wrap

This is going to sound weird, bear with me. I am not looking for the regular word wrap, which I already know how to toggle. Is there any possibility to do a "document wrap" or "text wrap" in Notepad++...
0
votes
0answers
16 views

Can Spamassassin be made to advise match details in description

I have a number of Spamassassin rules which use simple regex. Normally this regex is matching something like /(opt1|opt2|opt3)/i When a rule matches, is there a way I can include the matched code ...
1
vote
1answer
61 views

Using powershell + regex to tidy file names

I have a hard drive containing files with names that have been formatted by the "File History" feature of windows. A typical file name looks like this: Randomfile - blah (2015_05_29 14_56_40 UTC)....
11
votes
4answers
40k views

Can you do Regular Expressions in Excel without VBScript?

I'm looking for an Excel function that I can put in a cell to do a regex search of the contents of another cell. Is there anything available to do this? I'd prefer not to have to add VB Script to ...
1
vote
1answer
32 views

Notepad++ grouping/capture not working

A regular expression such as "(Received):" should match every "Received" that precedes a ":". N++ is finding for me the whole string: "Received:" So instead of highlighting in my document "Received" ...
0
votes
0answers
45 views

Searching for a string with grep

I'm looking for a way to retrieve a dollar amount from a website using a combination of wget and grep. This is what I've got so far: wget http://csgobackpack.net/?nick=jotnova -q -O - | grep -o "[...
9
votes
5answers
21k views

NotePad++ - Why does finding ^ not work?

I am trying to move away from TextPad, and I just can't get regular expressions like ^ and $ to be replaced. I have definitely ticked the regular expression box. What am I doing wrong? I am trying ...
0
votes
1answer
17 views

How to unhighlight 1st special caracter if any

(?:[^.]|^)((?:\b(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|0?[0-9]?[0-9])\.){3}(?:\b(?:25[0-5]|2[0-4][0-9]|1[0-9]{2}|0?[0-9]?[0-9]))\b(?=[^.:/]|$)) this highlights correct IPv4 address, but if at front there ...
1
vote
2answers
78 views

Failed to remove extra spaces using wildcards in MS Word

I have multiple instances of [word]- [word] in a text, e.g. self- interest instead of self-interest, which is the correct form. I am trying to remove the extraneous space after the stroke using MS ...
1
vote
1answer
61 views

How to fetch only email ids from a long text file?

I have text file with 1000s of words. This text file also contains several emails in it. I wanted to fetch all those emails only from the text file. Can someone pls help me. I have tried several ways ...
0
votes
1answer
32 views

I want a for loop to go through files with two diffrent extensions

I want the following loop to go through m4a files AND webm files. At the moment I use two diffrent loops, the other one just replaces all the m4a from this loop. Also the files that ffmpeg outputs ...
0
votes
1answer
68 views

Perl replace string inside file with the filename?

I need to replace a string in a JSON file with the filename of that file. I successfully matched the string to be replaced using the regex below, but I can't figure out how to get the filename in ...
1
vote
1answer
26 views

How can I display all mail from one specific author in Mutt?

I would like to display a search in mutt; i.e. all mails send by a specific author in inbox. ~f author displays only the first mail from "author" surrounded by different mails. And I cannot ...
0
votes
1answer
31 views

Microsoft Office Field Code regex on filename?

Is it possible to filter the filename of the Word file to present it inside the document? Let's say I have the following filename: Acme Co - Project XYZ - Code #123 - Year 15.docx I need to get Acme ...
1
vote
1answer
59 views

Automatic replacement of expressions

Maybe this can be achieved through (extended) regular expressions, but I really don't know if or how. There seems to be a way to access "things that are found" by using $1, $2, … but I have no idea ...
3
votes
2answers
10k views

How to replace line in file with pattern with sed?

I'm reading a lot of documentation on sed, and am still stumped on my particular use case. I want to replace this line in a conf file with my own line: Replace this line: #maxmemory <bytes> ...
0
votes
1answer
110 views

How to run regex find and replace using windows command line

I want to perform complex find and replace that I do with notepad++ using command line. I found many solutions from web but none of them matches my requirements. I have one file in which I want to ...
0
votes
1answer
437 views

Find duplicate phrases - any tool or regex

I've got a long document, and I suspect that some phrases (one or multiple sentences) are identical or at least similiar. Is there some way to find these repetitive phrases? Some tool or regex?
1
vote
1answer
968 views

How can I convert *.vtt subtitles to *.srt subtitles using regex (regular expressions) in notepad++?

As I learned, every line in a .vtt file starts with something like this: 00:00:06.984 --> 00:00:12.020 (line.1) But it should be like this for a .srt file: 00:00:06,984 --> 00:00:12,020 (...
2
votes
2answers
411 views

Regex to select only specific number of spaces

I am using notepad++ and I want to do a find & replace operation. For example 4 number of spaces means 1 tab 6 number of spaces means 2 tabs etc. In my file all the spaces are in the ...
1
vote
1answer
826 views

Removal of everything between two characters in Ms Word

I need a pattern to remove everything between the "<" and ">" characters. An example would be: <blah blah blah>Something I want <blah blah>really bad<blah blah> becomes ...
1
vote
0answers
135 views

TextAnalysisTool.NET equivalent for OS X

I've used TextAnalysisTool.NET in the past for analyzing log files on Windows machines and found it incredibly useful. I love the simplicity+power that it achieves for dynamically grepping log files, ...
12
votes
2answers
10k views

How to search for one of two similar strings in Vim?

In Vim, if I want do a search that matches "planA" or "planB", I know that I can do this: /plan[AB] This works because the regex allows for either A or B as its set of characters. But how can I ...
0
votes
1answer
67 views

Sed (or other) script to replace a character within the capture group

I'm attempting to convert Pandoc markup to Confluence wiki markup, I'm using markdown2confluence to do the bulk of the work. This works quite well except where I'm talking about CSS and FreeMarker ...
3
votes
2answers
17k views

Merge Excel rows from two sheets

I'd like to start this question by apologizing, there are numerous questions about merging excel rows, still, after browsing the web AND the list of "Questions that may already have your answer", I ...
0
votes
1answer
15 views

RegEx in FileZilla for Sub Folders

I have a RegEx of \/lib\/dam\/\d+\/0 Using FileZilla, I only want to display folders that have paths that end in 0 e.g. /lib/dam/1000/0 /lib/dam/2000/0 /lib/dam/3000/0 ... /lib/dam/200000/0 ...
0
votes
1answer
27 views

grep command returning 0 - match all characters that are not digits globally

I am looking to search a file for all strings that do not contain digits, I've come up with the following regex. \D*/g Which works as I want in the this online tool: https://regex101.com/#pcre, but ...
0
votes
0answers
24 views

tricky regular expressions for html > latex conversion

While converting a html document to latex, I want to replace patterns like < img STUFF src="STUFF/image.png" STUFF / > with \includegraphics{PATH/image.png} where STUFF consists of words, ...
0
votes
1answer
70 views

How to do regex renaming with Better File Rename (on Windows)

I can't find any documentation at all about renaming files using the regex functions in BFR. I know I can use other apps, but I want to use this one. http://www.publicspace.net/windows/...
1
vote
1answer
109 views

Regex to match “a string of length less than X resides between two ”>“ symbols”

The have text in this form: >xxxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxx xxxxxxxxxxxxxxxxxx >xxxxxxxxxxxxxx xxxxxxxxxxx > I need regex to match all >xxx... if there is ...