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
0answers
13 views

Find all instances of a string where the line doesn't begin with a comment character?

I'm doing a Find in Files for a few strings; "V1.10", "V1.01A", "V1.2" I'd like to find all instances of those values (fine if I have to run 3 different searches) except for lines that start with ' ...
2
votes
1answer
16 views

Match first next word matching a given pattern using sed

I'm having trouble getting the following behaviour: input='somestring... --key1 val1 --key2 val2 --key3 val3 somestring...' output='val1' I tried using: echo $input | sed -nE 's/.*--key1 (.*) ...
0
votes
2answers
33 views

Regex remove line contain character

I have a list of values being returned to me and they all end with a | like below: testdata1-old | testdata | test2-old| I want to delete all the lines containing -old. What regex can I use?
0
votes
1answer
34 views

Replace highlighting characters with something else

I wish to replace color codes with something else. For example, running cal command i want to get some html tags instead of color codes: July 2015 Su Mo Tu We Th Fr Sa 1 2 ...
0
votes
2answers
20 views

Basic regex match up to first period [duplicate]

I am trying to match a search term up to a first period using grep So for example, grep-ing through foobar searchterm. hello world. should print foobar search term blah. I save the above to a ...
1
vote
2answers
31 views

Matching a sentence with grep

I'm trying to grep for the full sentence containing a search term. I've tried grep (^.|\.\s).*searchterm.*(\.\s|\n) but it's not working and I'm not sure why. To clarify: I want stdout to print ...
2
votes
1answer
19 views

Notepad++ Regex find line pattern but only replace one line

I am new to regex. I want to modify lines in a text file based on a particular pattern. I was able to write an expression to find the pattern but in the group of line that it returns I want to only ...
0
votes
0answers
11 views

Replace numbered paragraphs from one document to another?

I have two documents that are identical, but one is in English, the other in Spanish. I took the first and took care of reformatting it by hand, mostly. Now, rather than going through the lengthy ...
0
votes
0answers
7 views

Vimperator — Custom ExtendedHit to launch script/program on matching regex

I want to define a custom extendedhint in vimperator that: Matches a regex pattern Feeds that match to a script as such: ~/bin/script regex-match-as-arg Where should I start solving this problem? ...
0
votes
0answers
19 views

regex search compressed password protected files

I have a repository of a few million large text files. I need to regex search them on a regular basis. Because they are large, I use gzip to compress them and zgrep to search them. I have been asked ...
0
votes
0answers
17 views

nginx regexp rule to block all urls containing a '.js?foo'?

I'd like nginx to deny all requests to static files followed by ?foo, like /path/to/somestatic.js?foo or /another/path/to/my.css?bar This is a trick that application layer ddos attacks seems to use ...
0
votes
1answer
19 views

How to add regex aliases in Postfix when using MySQL

I need to create regex based catchall aliases in Postfix setup with MySQL. I have found examples of a mysql_virtual_alias_maps_regexp.cf with this query: query = SELECT goto FROM alias WHERE '%s' ...
0
votes
3answers
45 views

Unix grep finding file beginning with [pattern]

I would like to find files that begin with a particular pattern i.e. the first line of file should contain the pattern, and then print the first 10 lines of such file, is there a way to do that? Is ...
1
vote
1answer
25 views

zsh regex failing, bug or user error?

This regex works (stripping out -search) [~%]for i in foo*-search-aae-status ; do echo $i(:s/-search//) ; done foo1-aae-status foo2-aae-status foo3-aae-status foo4-aae-status foo5-aae-status But ...
0
votes
0answers
14 views

Moving line with regex notepad ++ [duplicate]

I want to move line down to up with regex notepad ++ or batch script windows example : Video.asp?ZoneID=791 Video.asp?ZoneID=792 Video.asp?ZoneID=793 Video.asp?ZoneID=794 Video.asp?ZoneID=795 ...
1
vote
1answer
21 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 ...
0
votes
0answers
24 views

Find and replace by a single dot several series of two dots attached to the end of words

I want to replace every series of two dots in a document by a single dot, excluding the cases where there are three dots in a row, i.e., the written ellipsis (...). Yet, the series of two dots always ...
-1
votes
0answers
29 views

Download web pages and extract contents through regex?

I'd like to download some web pages, extract some of their contents on the fly through a regex and save those into files. The utility should be command-line-based. Some pseudo-code: wget.exe -i ...
-1
votes
2answers
37 views

Find and replace {0,} occurrences in Word

Are there any alternatives to the concept {0,} which is not allowed in MS Word? For example, if I wanted to replace, by a single abbreviation, the next five terms: articul articulo articula ...
0
votes
2answers
33 views

search and replace in VI

I need to convert '12.22.54' to '12:22:54' in a string below so that it works in MS SQL. cast('14-JAN-14 06.65.22 AM' as datetime),'63.124.79.253'); cast('14-JAN-14 12.22.36 AM' as ...
0
votes
1answer
32 views

Using ' (' (space followed by parenthesis) as field separator in awk

In an awk script I am trying to use ' (' as the field separator. However unless I escape the bracket with double back-slash, like this: BEGIN {FS=" \\("} it does not work. If I use FS=" \(" I get ...
0
votes
0answers
19 views

Adobe Brackets: How to find and replace using Regex?

I have installed the latest version of adobe brackets on my Dell laptop. Before this I was using notepad++ and there are many features in notepad++ that I'm trying to load in brackets via extenaions ...
2
votes
2answers
42 views

Rename files based on folder name

I have lots of index.html files in unique named folders (one per folder). I wish to rename each file with that of it's parent folder name. From: /folder1/index.html /folder2/index.html ...
0
votes
1answer
21 views

Regex excluding [about:] pages in firefox

I'm trying to get stylish style sheet to be deactivated on about: pages. I believe the regular expression below should be able to do just that, but firefox seems to be of a different opinion. Could ...
-1
votes
2answers
45 views

Delete text before “=” sign in Notepad++

How to delete a text before "=" in notepad ++. Example 'abc = def' '123 = 456' Output Should be 'def' '456' Thanks
0
votes
1answer
19 views

How to specify a replacement string with a newline in it?

I am using Source Insight. I am trying to replace the string Tmem::Set with the following string that includes a newline in it. //here memset I set the replacement string to be the regex [//here ...
0
votes
1answer
18 views

Line Manipulation Reformat text Notepad++ or PSPaD

I have about 40,000 lines I need to look like first line - no paragraph marks. The trouble is, I can't use join lines then use (\d\D+)& $1\n to get like line 1 because of numbers inside of ...
0
votes
1answer
37 views

Matching () with a Unix/Linux regex

I have a couple files with the name (a).1 (a).2 ... (a).100 Since a lot of processing tools don't really like ( and ) in the filename I thought it best to rename them to a different name. I googled ...
0
votes
0answers
32 views

Notepad++ extract links from html tag with class

I have a text which consists of different html elements and links like this one: <a href="somelink" class="details btn secondary large">. I want to extract links from a href tag. What are ...
2
votes
2answers
51 views

Treat part of a Regex expression as non-special characters

Let's say I've got a regex expression utilizing some of the special chars, but also a portion with 'normal' text that just happens to have some symbols in. Let's also say I'm too lazy to start ...
1
vote
2answers
69 views

Best way to increment numbers in one line in Linux [closed]

I have one line with lot of entries among which is also time. ('DEFAULT',17,NULL,'2014-07-14 10:30:00','Something','2014-07-14 06:30:00',1),('DEFAULT',26,NULL,'2014-07-14 ...
2
votes
2answers
39 views

Regex in LibreOffice Writer - finding “everything” but one thing

I have a text (html code) and need to find <p> tags with their classes, id, styles (if any) etc. I'm doing this using the following regexs: <p(.*?)> or (<p([^>]+))> The pattern ...
0
votes
1answer
36 views

Notepad++ illegal XML character target search using Regex

Fellow Forum Members, I am using the latest version of NotePad++ and I have done a search for illegal XML symbols such as "&", ">", "<", "©" among 200 separate XML files. I found a couple of ...
3
votes
1answer
190 views

Notepad++ - Merge all lines into one and add separator

So this is my situation: I have a lot of lines like this: line1 line2 line3 line4 And they all start with different spaces. What I want to do is merge all the lines in the ...
0
votes
2answers
37 views

How to construct a regex find/replace in word 2010

I have some limited experience with basic javascript regex, which I've used to manipulate some user data entries. But now, I've been asked about manipulating MS Word 2010 documents. Specifically, my ...
0
votes
1answer
22 views

Modify terminal STDOUT/STDERR to change the line colour based on a REGEX

Is this possible? What I would like to achieve is when running unit tests (Python) to highlight any line which matches the path to the current project directory and leave other output untouched. ...
1
vote
1answer
57 views

How do I edit an xmlTV file using sed (or a similar tool)?

I have an xmlTV file that looks like this: <channel id="10125.dvb.guide" <!-- number="62" type="0x1" flags="0xf" bouquet="4097" region="4a" sid="10125" -->> <display-name>ITV ...
3
votes
1answer
26 views

Microsoft Word Wildcards to Find Any Dates of a certain form

I am editing a very large document (~200 pages), with multiple dates on each page. I am looking to use MS Word's wildcard function in the find-and-replace feature to remove these. Some examples of ...
0
votes
0answers
30 views

OS X Numbers Find and Replace With Variables

I have a massive spreadsheet and a column has a load of HTML in it and i've spotted an error in the code so I need to update it. Each cell with the code in has a bunch of HTML, heres what the error ...
2
votes
1answer
75 views

How to search for special characters in Sublime Text 3

I have a few lines starting with the character # and I search for it in SublimeText 3, but ST3 said unable to find \b#\b. I then tried to search \# and it also fails (with regular expression mode ...
0
votes
1answer
56 views

BASH : grep count same word occurrence

Is it possible to count the maximum number of occurrences of a word in a string using only grep ? Here is an example of what I want : script.sh "aaaa bbbb ccc bbbb azesd bbbb" would return bbbb ...
0
votes
1answer
226 views

Exclude a single file from an nginx location match

I have a location on nginx like this: location ~* /(images|cache|media|logs|tmp)/.*\.(php|pl|py|jsp|asp|sh|cgi)$ { return 403; error_page 403 /403_error.html; } I have a php script that combines ...
1
vote
1answer
38 views

MS Word regex insert carriage return in match

It appears that MS Word accepts regular expressions for finding and replacing strings. I would like to use regex to add carriage returns to a block of text, in order to parse out individual lines. ...
0
votes
1answer
29 views

Partial formatting in Microsoft Word find and replace

I want to use Word's "Advanced Find and Replace" tool to find this string: See, e.g., And replace it with this: See, e.g., The difference between the two strings is that the second comma ...
-1
votes
1answer
25 views

Backslash expression to add an underscore at the end of a word?

I have a huge list of words where every one is in a new line. I'm currently using the text editor SciTE which can perform backslash expressions. Which expression do I need to use to add a _ ...
0
votes
1answer
24 views

vim regex :s/^\s*\(.\)\+/\\\1/g only shows last character substituted

I need to prepend a backslash \ to each character in a string, excluding any leading whitespace. I believed the following would do the trick. :s/^\s*\(.\)\+/\\\1/g but it produces this result for ...
2
votes
3answers
338 views

How should I write a regex to match a specific word?

I've been trying to get a specific regex working but I can't get it to do what I need. Basically, I want it to look for ROCKET. The regex should match ROCKET in upper or lower cases, and with or ...
2
votes
2answers
83 views

How to recursivly delete all JPG files, but keep the ones containing “sample”

How can I find and delete all the .jpg files in a directory tree with the exception of the ones containing "sample" in their filename? For example : a.zip -> keep it b.jpg ...
1
vote
2answers
86 views

Notepad++ Find and Replace: Wildcard Varying Number of Lines?

I have a tricky problem. I need to make a minor change to a large number of xml files (500+). The change involves switching a value from 'false' to 'true.' The line that needs to change looks like ...
2
votes
1answer
138 views

How to capture a couple of lines around a regex match?

I am searching for a regex expression to match couple of lines over the matched line. For example: ABCDEFGHADEFGH ABCDEFGHADEFGH ABCDEFGHDEFGHABCDEFGH ABCDEFGHDEFGHABCDEFGH ABCDEFGHABCDEFGHABCDEFGH ...