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)

0
votes
2answers
7 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.
5
votes
2answers
233 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 ...
1
vote
1answer
11 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
7 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
1answer
34 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
2answers
30 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 ...
0
votes
0answers
8 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
20 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
32 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 ...
0
votes
1answer
26 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 ...
7
votes
1answer
117 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? ...
3
votes
2answers
226 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 ...
0
votes
1answer
28 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
37 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 ...
1
vote
0answers
52 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
38 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 ...
3
votes
2answers
338 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. ...
1
vote
1answer
86 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 ...
3
votes
2answers
40 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
54 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
18 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
39 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
42 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
27 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, ...
3
votes
3answers
233 views

Using vim to delete all lines except those that match an arbitrary set of strings

I use vim to remove all lines except those that match a particular string, e.g. :g!/[string that I want to remain in the editor]/d Works great. But what I really want, and haven't found anywhere, ...
0
votes
0answers
16 views

How to define new scopes using arbitrary delimiters in Sublime Text 2

TL;DR: How do I bring Ruby-like comment scope to plaintext files for sublime text? I want to customize my plaintext file look in ST2 by allowing comments. So far I have managed to extend the ...
1
vote
1answer
44 views

How do I remove HTML from MS Word 2010 document with Find/Replace Wildcards/Regex?

I found a website to help me choose domain names. I have my shortlist which I can't export, but I need to share the list with some other team members first. It also won't let me copy and paste the ...
0
votes
0answers
29 views

Can I apply a regex to file filter on Notepad++?

I have a folder full of xml files, and I want to search through them for a particular ID. However, I only want to search the files that are of the format hello_apple_01.xml, hello_apple_02.xml... ...
1
vote
2answers
84 views

Remove quotation marks around a number (while leaving other quotes)

I want to replace all text like this: "latitude": "32.336533", with this: "latitude": 32.336533, I'm using Notepad++.
0
votes
0answers
26 views

How to identify tab delimited columns in Multitail

I'm trying to remove certain columns from my logs, where columns are delimited by tabs. Here are some ways I've tried to remove the second column which didn't work. multitail -kc " " 2 my.log ...
0
votes
2answers
26 views

Multiple exclusion patterns with grep

I would like to select lines which do not match the specified pattern, where I have multiple patterns to exclude. As an example, I want to exclude lines which start with the keywords apple and banana: ...
0
votes
1answer
39 views

Redirect domain name

I have two domain names pointing to my server. I want them both to serve identical HTML. I thought I would just do the following, however, it was unsuccessful. Note that I eventually will want ssl ...
0
votes
2answers
37 views

Removing Nested LaTeX Tags with Regex

How would I use regex (such as with sed) to remove all \index tags that occur inside any \index tags? For example, a nested mess like this: \index{Test\index{test\index{test}}ing One\index{one} ...
2
votes
1answer
66 views

Use perl to do multi-line replacement [closed]

I have to do some replacements in many *.c files. I want to do the replacement like this: original: printf("This is a string! %d %d\n", 1, 2); result: print_record("This is a string! %d %d", 1, 2); ...
2
votes
1answer
34 views

find -regex not recognizing \d digit

I have a directory structure that looks like the following: processor0/10 processor0/10.1 processor0/10.2 processor1/10 processor1/10.1 processor1/10.2 ...etc... processor7/10 processor7/10.1 ...
1
vote
1answer
52 views

How to use REGEX to capitalise the first letter of each word in a sentence?

I would like to use regular expressions (REGEX) to capitalise the first letter of each word in a sentence. I have achieved the same result in programming languages, but it seems that using regular ...
1
vote
2answers
56 views

Microsoft Word 2010 regex replace

I am having a problem with a regex find and replace in Word 2010 (Windows 7). I want to convert reference citation numbers in parentheses to the same numbers in brackets. For example, (20-23) should ...
0
votes
3answers
49 views

egrep for time in H:MM:SS format

Working on the file an need to grep the line with a time stamp in the H:MM:SS format. I tried the following egrep '[0-9]\:[0-9]\:[0-9]'. Didn't work for me. What am i doing wrong in regex?
2
votes
1answer
31 views

Regular expression that finds same words within 'n' words of each other

I'm trying to put together a regular expression search that finds any two (or more) words that are within n (e.g., more than 1, less than 5) words of each other. The goal is to search over a prose ...
0
votes
0answers
23 views

Apache mod rewrite testing tool (no online tools)

I've tested some great RegEx standalone tools and found a couple of mod rewrite online tools, but is there some standalone tools for testing apache mod rewrite definitions? Ideally, I want something ...
0
votes
1answer
40 views

Vim experts: how to find a number within a range based on two numbers? Eg “777” matches “667:888”

I need to search for numbers in a text with Vim. The numbers I need to find are often within a range based on two numbers and I need to match that range based on a single number. For example, in my ...
1
vote
3answers
68 views

Standardize \n and \r in Vim's search/replace syntax

In Vim, one searches for newlines as \n, but newlines in the replacement-string must be entered as \r. I understand that there are reasons for this behavior, but for my purposes I just find it ...
-1
votes
1answer
113 views

Microsoft Word Wildcards

This is long, I hope I made it clear! Please ask if something is not explained correctly I have a document that has the word "The" capitalised in many places it shouldn't be. I wish to change "The" ...
1
vote
1answer
33 views

How to remove characters from a matching string?

I want to remove spaces from a list of phone numbers. The phone numbers are in the following format: "+33 x xx xx xx xx" most of the time (quotes included). Spaces can be placed differently. In ...
2
votes
0answers
26 views

find using regexp and echo matches

I have about 50 users in /home/ directory and I have cloned a git repository to everyone: Executed at /home/ as root user: find . -maxdepth 1 -type d ! -name . -prune -exec git clone ...
0
votes
0answers
59 views

Saltstack regular expression to target all except

I'm having trouble using regex with salt to target every minion except one. I have tried every example I can find and exhausted my limited understanding of Perl regex. I expect this to target every ...
1
vote
3answers
85 views

Can anyone explain why this pattern matching is not working using sed

Trying to print out specific times of logs based on recommendation from this thread from super user. I am not sure why my patterns are not being matched by sed. I have the sample date and time I am ...
1
vote
1answer
51 views

Matching only numbers that come in numerical order

I have numbers in [.] indicating the page number of an orginal printed document I am transcribing. However, the document also contains other numbers in [.] that do not correspond to page numbers. For ...
1
vote
2answers
66 views

Replace all, “But” Regex Notepad++

I have a text file with lines looking like the one below : ('8510851205', 'needthishere', '', ''), I need it to remove everything and leave only needthishere on every single line. How would I do this ...
0
votes
1answer
51 views

Notepad++ exclude starts with a two digit number

I would like to exclude anything that starts with 87. By combining the first two digits, I can find lines that start with ^8+7 or ^87. But I was trying to use ^[^8+7], but it doesn't seem to work. I ...