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
73 views

Grep word in one file, and use that word to match in another file, adding the thing that follows the match

I want to grep several words in file1, and use each word to grep what follows after its match in file2. And then I want to add the string that followed the match to the word I used into file03, so ...
-4
votes
1answer
71 views

Remove two dots back from end of line

I need to use regex to remove all text starting at the end of line and going back two dots. gtk2-2.24.22-2.fc20.x86_64 becomes gtk2-2.24.22-2 This is the output from rpm -qa to a text file, and ...
0
votes
1answer
63 views

Notepad++ regex - numbers

I tried to search for it and experiment it out, but I couldn't figure it out. In notepad++ I have a line like: 102. or 12 and I would like to delete the whole line (so i would need \n\r I ...
0
votes
1answer
66 views

Notepad++ regex

I have a wall of text (no code, numbers or anything like that). The sentences are sometimes split in the "middle" by a "paragraph" or "manual line break". For example: The most obvious part was a ...
0
votes
1answer
27 views

OS X: Copying only files without a special string in filename

I have to copy only files from a folder that don't have following string in its filename: NNNNxNNNN (a 3 or 4 digit number followed by the character x followed by a 3 or 4 digit number again -> it's ...
2
votes
3answers
290 views

How can I find all files on a folder tree that have a none alpha numeric characters in it

I have taken over from someone else a lot of historic data. However the file names are totaly random and badly formatted IMHO. To start with I want to get a list of all files that contain spaces, or ...
0
votes
1answer
157 views

Microsoft Office 2013: Regular Expressions

I read the articles on RegExp in Office already. My wish is to manipulate quoted strings. I need to replace the quote characters with parentheses. For example: "Hello World." should be replaced as ...
1
vote
1answer
105 views

Remove duplicate lines in LibreOffice / OpenOffice Writer

I'm working on a text file in Writer which is basically a sorted list of words and phrases. It contains some duplicates I want to remove. Normally I would use a regular expression in Search & ...
3
votes
3answers
72 views

Sed replace only in even numbered lines of a file when replace commands are written in a file

I have all the replace commands in a file (say replace.sed) and i use it with -f flag of sed (sed -f replace.sed InputFile). But now i ran into a condition where i need to apply these replace rules ...
0
votes
2answers
59 views

Is there any way to do a plain text regex find and replace with standard Windows software?

Long story short, I need to enable a client to routinely run a regex find and replace that looks like this on many SVG files that are up to 3mbs in size: Find: font-family=".*?" Replace with: ...
2
votes
1answer
12k views

.htaccess 301 redirect with regular expressions

If I have: redirect 301 /users/foo http://www.example.com/profiles/foo redirect 301 /users/bar http://www.example.com/profiles/bar Can I do something like? redirect 301 ^\/users/(.+)$ ...
4
votes
1answer
229 views

Bash regex to rename set of files

I have to rename a set of files, using the rename command (with a regular expression).  After some tries, I'm not able to find an expression that gets the expected result. I've got a file pattern ...
1
vote
1answer
243 views

How do I use wildcards in Notepad++ to 'find and replace' all of this text?

I would really appreciate some help with this. I am working with a large corpus of text that has been marked-up with XML script and I need to tidy some things up. More specifically, there are several ...
1
vote
1answer
192 views

Notepad++ Search/Replace Comments { inside } Curly Brackets

is there a way in Notepad++ (whether by Regex or some other way) to replace/remove comments within curly brackets? { some comments { nested comments } need to be deleted } I want to remove the ...
4
votes
2answers
41 views

Rename ':2f' to '-' on folder names in Linux

I've got a hard drive taken from a NAS drive where files had been put on from a Mac - However, some of the filenames had been, for example, 'backup 16/07/14' which has then been changed to 'backup ...
0
votes
1answer
52 views

Weeding out invalid html code with regex

I need a pcre regex that will select all html img tags without a src part. Long story. With help I got to (?-s)<img(?!.*?src).*?\/> which worked fine until a line got a second img tag WITH src ...
5
votes
2answers
357 views

Checking file names inside a directory with Regular Expressions

I have a list of files inside a directory and I want to make a bash script which uses a regular expression to check if every file name inside it has this syntax: xxxx_xxxx_xx_xx Where x are ...
0
votes
2answers
72 views

How to download all file with name emp* using curl from a FTP site

How can I get all files downloaded from a FTP site directory with file name like emp*. Please suggest.
1
vote
1answer
51 views

Insert a line of text before lines matching a regex in vim

I'm attempting to add a column to an HTML table using vim so I need to add a pair of <td> tags the line before each </tr>. So far I have :186,$s/ <\/tr>/<td><\/td> \n ...
0
votes
1answer
67 views

How to navigate PHP-based pagination with WGET?

I'm trying to come up with a list of possible names for our next baby boy and have been looking through the site IndiaParenting. Each name on the site has a detail page at a URL like this one ...
0
votes
2answers
49 views

How to search the text for several lines and find in order using regular expression

Trying to figure out the regular expression to be used in Notepad++ where I can search the text below (as an example) and find the results in order. Sample Text: { USERECOVERDB 1 } protocol ...
12
votes
6answers
4k views

Removing ANSI color codes from text stream

Examining the output from perl -e 'use Term::ANSIColor; print color "white"; print "ABC\n"; print color "reset";' in a text editor (e.g., vi) shows the following: ^[[37mABC ^[[0m How would one ...
1
vote
4answers
2k views

Batch renaming of files using regular expression in Unix

I have several thousand files of the form: [8-digit number]_[number I want]_S60491_I129111.dcm. I wish to remove everything except the number I want, and use that as its name. In Ruby, I can get to ...
3
votes
1answer
6k views

Is it possible using regular expression in inbox rule criteria

I want to filter all mail whose subject starts with [SomeWord], so I wonder is it possible using regular expression(such as ^\[SomeWord\]) for inbox rule of outlook. I'm using outlook web aceess, not ...
0
votes
1answer
52 views

Notepad++: How to remove a section of text with regex

I have a file that has lines like: string1,string2,string3 I would like it to just be string2 How would I use regular expression to do this?
0
votes
0answers
21 views

mRemoteNG Panel equal to Name

I wanted to have the Panel=%name% or something similar in mRemoteNG. Is it possible to do this within the program? For now I resorted to using Regex find replace in an editor on the confCons.xml file, ...
-2
votes
1answer
32 views

Inserting line before lines containing a particular word

How to insert a line before a line ending with a certain word in textpad? For eg: I want to insert a blank line before every line that ends with the word 'Chapter'
0
votes
1answer
73 views

Using regex to select word before another word which starts with a capital letter

I would like to select all adjectives in a German sentence. As all German nouns are capitalized, I though one way would be to look for capitalized words and select the previous word. If the selected ...
3
votes
2answers
2k views

Grep: count number of matches per line

I'm trying to get the number of matches (in this case occurrences of { or }) in each line of a .tex file. I know that the -o flag returns only the match, but it returns each match on a new line, even ...
7
votes
1answer
152 views

Meaning of \b in .Net Regular Expressions [closed]

Microsoft has a nifty quick reference card for .Net Regular Expressions. But it seems to list \b as both matching Backspace and also matching "On word boundary". Which is it? Can \b really do both? ...
0
votes
1answer
451 views

Sed pattern for multiple lines

I want to remove all create table statements from a mysql script, but the statement runs over multiple lines. Like this: Create table ......NEWLINE... NEWLINE... NEWLINE....; So I tried this ...
1
vote
1answer
4k views

Extract substring before = sign using awk

Say I have some file with a bunch of lines in the form someString=someMoreCharacters anotherString.blah=foo=bar blah.blah.blah=foo.bar.=foobar Desired output someString anotherString.blah ...
1
vote
1answer
88 views

How to do concise two alternative substitutions in Windows Excel 2010? [duplicate]

Possible Duplicate: Can you do Regular Expressions in Excel without VBScript? I wish to replace a string pattern with another along the lines of the following: ...
2
votes
1answer
40 views

regex for specific number of numbers

I need to get the regex-pattern for the following sequence of numbers: X.XXX.XXX-X Every X is one number. How can I do that? I don't want to use *, because I need exactly the number of numbers.
2
votes
2answers
2k views

regex : does not begin by “pattern”

I have a lot of lines in my LIST file and want to list only lines whose name does not start by (or contains) "git". So far I have : cat LIST | grep ^[^g] but I would like something like : #not ...
2
votes
2answers
386 views

How to grep a line with a backslash at the end of the line?

I'm trying to grep a line with a backslash at the end of the line like: abc\ def ghij ... I hope it can grep the line "abc\". I tried the command below but they didn't work. grep -EHn "\\$" ...
6
votes
3answers
18k views

How to delete files on the command line with regular expressions?

Lets say I have 20 files named FOOXX, where XX is the number of the file, eg 01, 02 etc. At the moment, if I want to delete all files lower than the number 10, this is easy and I just use a wildcard, ...
0
votes
1answer
138 views

using sed to replace 1 line with a multi-line variable in ksh

I have the following text in a file: XXXX NNNN YYYY NNNN ZZZZ NNNN I want to replace the NNNN to make it look like this: XXXX NNNN DUTY FORECASTER: YYYY NNNN DUTY FORECASTER: ZZZZ NNNN ...
0
votes
3answers
41 views

set chars to uppercase between parenthesis

let's assume in vim I have following lines: all what (strong) people have to do is pushing (heavy) weights over (and over) again in order to gain muscles and I need to convert words inside ...
3
votes
2answers
3k views

How to search a text file for strings between two tokens in Ubuntu terminal and save the output?

How can I search a text file for this pattern in Ubuntu terminal and save the output as a text file? I'm looking for everything between the string "abc" and the string "cde" in a long list of data. ...
2
votes
0answers
488 views

Nginx rewrite to remove first (generic) path node

I am currently writing a dispatcher that will dispatch different URLs to specific service URLS. I essentially want to dispatch something like: POST ...
0
votes
2answers
56 views

Change number in last row in data seperated with commas in NotePad++

I have rows of data all separated with commas. How can I replace the last numbers after the last commas with the number 5 in NotePad++? For example: How do I replace 9, 17 and 124 with 5 in the below ...
2
votes
1answer
153 views

Replace spaces with colon (:) in Notepad++?

Suppose (this is sample data) I have these lines: A W BAKER X CANDLESTICKMAKER Y DOGCATCHER Z I want to change the whitespace ...
2
votes
3answers
435 views

Word find/replace: add space to postal code with wildcards

Using the “Find and Replace” dialog in Microsoft Word 2003, I want to search a list of addresses for postal codes (Canadian) that do not have a space in them, e.g., M2N3X6 L4C2A9 K5G1S7 and put a ...
3
votes
2answers
57 views

Match cell content based on line break

I take data from a helpline call in site and transfer it to Linux Libreoffice Calc (LC). Column C cells have 2 sets of data - two telephone numbers - 1 being the caller and 1 being the forwarded ...
0
votes
1answer
92 views

How to grep values under columns

How can I grep for a specific column name and display the value underneath that column. Sample data: StandByFile StandByPg StandByLSN StandByRcvBufUsed S0082160.LOG 621668 ...
-1
votes
1answer
31 views

Which regular expressions (POSIX or extended) are allowed in awk?

I'm wondering which kind of regular expressions (POSIX as in grep, or extended in egrep) am I using when type in regular expressions in awk?
0
votes
1answer
51 views

How to use a regex to organize song lists, changing their order from “Song - Artist” to “Artist - Song”?

I have a long list of songs in the format "Artist - Song", but I want them to be listed as "Artist - Song". How to change all items automatically with a regular expression, preferably on Notepad++?
3
votes
1answer
54 views

How do you perform a 2d search in vim?

I'm looking for lines in a file that match a 2-dimensional pattern. For instance, given the following input file: aaaba aabaa aaaba aaaaa aaaaa I'd like to use a pattern like ab ba ab to match ...
0
votes
1answer
60 views

Selective Find & Replace to pretty up my C code in Eclipse or Notepad++

I am working on a old C code which have debug statments like this: debug(1, "SomeDebugStmt %s %d", someString, someNumber); ... debug(2, "another SomeDebugStmt number 2 %s %d", anotherString, ...