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)

1
vote
2answers
71 views

Filtering input with sed (regex)

I'm having an issue with sed not returning what I expect when using a regex pattern to clean up some output from a mysql query. mysql -uroot -p -e 'SELECT `path` FROM db.media_gallery' | sed -n -r ...
3
votes
1answer
129 views

Saving part of found term when replacing in Notepad++

I want to use Notepad++ to find/replace large chunks of code, but a hefty part of it deals with arrays. How can I put a "variable" in Notepad++'s Find/Replace window so that part of it can be saved ...
4
votes
1answer
78 views

Why does grep need a dot in a regex using '$'?

I though I knew grep, but maybe not. I want to find all lines in a file ending with ':' If I run grep :$ ~/greptester.txt but to my surprise, it gives no results. Sometimes I confuse '^' and ...
0
votes
0answers
40 views

Match the First Occurrence In Text Using Boundaries

I need some help as I have been trying to figure this out all night. I need to match the first occurrence in an article. Something like this... The online marketing game has changed since the ...
2
votes
3answers
219 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
1k views

Add text to beginning and end of each line using batch/cmd

What I'd like to achieve in the end is to generate a text file that lists all *.txt files in the current directory with the path appended to the beginning of the filenames, and some other string after ...
2
votes
3answers
132 views

What does really mean null string?

I'm sure most of us know that when we want that some regex matches with a string at the begin of the line we must use "^" ... But, I'm trying to understand what really means "empty string at the ...
1
vote
3answers
11k views

Using wildcard search/replace in Notepad++

Here's my problem: In a .txt file, I need to find and replace thousands of instances of syntax like this: (see (a053007djfgspwdf)) or (see (a053007djfgspwdf) and (a54134xsedgeg)) or (see ...
1
vote
1answer
87 views

Is it possible to alias regexp substrings in vim?

I want to find and replace pattern containing floating point numbers using vim. I found this nice regular expression for such numbers: [-+]?[0-9]*\.?[0-9]+([eE][-+]?[0-9]+)? This expression makes ...
0
votes
1answer
220 views

How to match regex for TLD?

I know there are lot of regex for the purpose, but in my case the regex i want to write is one that matches following payload ...............sssfdf.makememad.com...... ........makemadcom..... ...
1
vote
2answers
75 views

How do you get SED to replace only the first set of characters in a search expression

Basically I think this question is more one of regex than SED directly, but it’s SED I’m using, so that’s where I’m starting from. I’ve got a web.config configuration file for an ASP.NET 2.0 website ...
0
votes
2answers
140 views

how to define regex to parse just TLD of domain name?

I have something as:- ....wasasa.org.pk wawwwsasa.msn.com ....ttrt .....ddd.dd www.edu.pk .ru I only want to pick following org.pk .com edu.pk The possible regex i wrote is ...
0
votes
0answers
47 views

Regex: find words, which were “mentioned” before

Example of file, where words "re", "urllib" mentioned at text start (after keyword "import"), and at text middle: import re import urllib test test regex = re.compile(r'href="([^"]+)"') data = ...
1
vote
2answers
106 views

Regex to match only if beginning of line isn't something?

I have some lines that I'd like to match and some lines I'd to exclude from matching in a file. I'd like to not match remote access</a> (main card) and would like to match anything ...
1
vote
1answer
144 views

Better way to extract a substring in bash

I have a list of mp3 files named like so: $artist/$album ($year)/$tracknum $title.mp3 Many of these tracks have incorrect or missing tags, which I am correcting through the use of id3v2 and regex ...
0
votes
1answer
7k views

Delete Text before and after a specific character in Notepad++

i want to extract a string which is between two quotation marks, deleting everything before and after the quotation marks, including themselves. For example this: 6 6 "The Socratic Method" ...
0
votes
1answer
1k views

Regex to parse URLs from text

I have this regex: [a-z]+[:.].*?\s I run it on the following text: regexbuddy.com www.regexbuddy.com http://regexbuddy.com cvc http://www.regexbuddy.com cvcv http://www.regexbuddy.com/ g ...
0
votes
0answers
68 views

Emacs rx semantics

I have the constructed the following regular expresion using rx.el module (rx (and bol (0+ (not (any "#" "[]*" "\n"))) " " (or "#" "[]*") " ")) I want to change the string []* for the string ...
0
votes
2answers
205 views

Regex replace with Notepad++

In my XML file there are lots of sub strings starting with STDSUP- and then three digits. For example: STDSUP-123. I would like to replace the STDSUP with CCDA. There are some sub strings where ...
1
vote
1answer
78 views

Convert command-line commands from one tool to another in notepad++

I have a script with lots of lines like this: ss Get $/%SS_SOURCE_PROJECT%/DLL/Vim25Service2005.dll -I-Y -R -VL%2 ss Get $/%SS_SOURCE_PROJECT%/97AUTO/*.* -I-Y -R -VL%2 We're migrating from one tool ...
0
votes
2answers
70 views

Merge two separate sed expressions into one?

I'm reading the RealName from dscl for various users. Depending on the user, the output can be one of the following two: RealName: <name> Or: RealName: <name> So I have sed -e ...
0
votes
0answers
76 views

Firefox Extension To Save To Folder Named After Text On Webpage

I am wanting to find or create a Firefox Extension that can create and save to a folder, based upon the text in a page's tag. I would want it to do the following: Check the page's html for a ...
0
votes
2answers
3k views

How to remove the 1 last character on every line in Notepad++?

In Notepad++, how do I turn this: aliraft into this: aliraf
0
votes
2answers
182 views

Replace timestamps by increasing number

Hello again Superuser! I have ~40 .txt files with rows like this: 11:20 : Go to lunch 13:40 : Go to parkinglot 14:40 : Wait for flight to arrive .. (and so on for ~90 lines per txt file) And I ...
0
votes
1answer
67 views

Search files for text matching format of a Unix directory

I am attempting to search through all the files in a directory for text matching the pattern of any arbitrary directory. The output of this I hope to use to make a list of all directories referenced ...
1
vote
2answers
71 views

Checking version of Applications installed in ~/Applications with unknown username

I'd like to check the version of Firefox through Apple Remote Desktop of all managed computers. I have written this, but it only checks for Firefox in /Applications /bin/cat ...
3
votes
2answers
752 views

Regular Expression for Search and Replace in Microsoft Word

I need to do a search and replace for the text below in Microsoft Word. Skill No 24: and replace it Skill No: 24 Can anyone help me with the Syntax?
1
vote
1answer
48 views

Vim global block move by patterns

I just came across this example in Learning the vi and Vim Editors: .Rh 0 "Get status of named file" "STAT" .Rh "SYNTAX" ... .Rh "DESCRIPTION" ... .Rh "PARAMETERS" ... The command to move ...
1
vote
2answers
210 views

How to import this data set into excel? (column headings on each row delimited by a colon)

I'm trying to import the following data set into Excel. I've had no luck with the text import wizard. I'd like Excel to make id, name, street, etc the column names and insert each record onto a new ...
1
vote
1answer
455 views

Matching character ranges and paragraph breaks in Find in Microsoft Word

I have several Word documents where line breaks (paragraph breaks) have been added purely for cosmetic reasons (probably by a human, but maybe by an OCR system or something similar). I want to remove ...
2
votes
3answers
117 views

sed regexp address case-insensitive matching

How to specify a sed regexp address which is case-insensitive? E.g., sed '/my-kw/d' But I want sed to remove lines with my-kw in any cases. Thanks
0
votes
2answers
396 views

Find CamelCase / WikiWord words using regex in Notepad++ (Np++)

I need a regex statement to find any words formatted in CamelCase. Examples include: CamelCase. Trunk_Note. Med-Dr.Zung. _MyToDo-Housework. _MyToDo-Vacation_Cancun iOS_GReader Key points: ...
0
votes
1answer
98 views

Regex: Is there a character for increasing digits in PCRE?

I am using a PCRE compatible file rename program. Is there a character or pattern I can type in the "replace" field of the program to tell it to append numbers at the end of file names and that they ...
4
votes
1answer
219 views

Regular Expressions: How is group matching useful?

I've decided to learn some regular expression basics. I am using the Regex One lessons online and I was stuck at lession 11 for a while, but I think I got it now. This was the task. "Write a regular ...
0
votes
1answer
170 views

Grep get everything except matching

Lets say I have a text file that says: Hello my name is agz. I am asking a question that is important. If i type: grep -v "is" /path/to/file, I should get no output because both lines have "is". ...
-2
votes
1answer
166 views

How to open extension in Visual Studio 2010

I have installed two extensions in Visual Studio 2010. Regex Tester Regular Expression Tester Extension Both extensions installed successfully. I restarted Visual studio. But I don't see them. I ...
1
vote
1answer
92 views

Notepad++ find between lines

I would like to find out if there are "duplicate" text-fragment between two specific lines. For example i would like to find out that in the first "TestMethod" there is twice the "TC.Requirement" ...
3
votes
3answers
75 views

Regular Expression: how to match 'ab','ac' and 'a'

Now, I have three strings to be matched by a single re -- 'a', 'ab','ac' I suppose one correct re should be 'a[bc]?', but it seems not correct. What is the correct one? I try it in grep command. And ...
0
votes
1answer
182 views

VIM: Yank multiple non-continous chunks of text into a registers

I have some lines of text that follow a pattern and some that don't. I'd like to copy the lines that follow this pattern and then copy/yank them into a register so that I can paste them as is ...
1
vote
1answer
78 views

Finding matches around specific text in Notepad++

How can I find matches just Around text same as this: if(strcmp(cmdtext, " /x ", true) == 0) if(strcmp(cmdtext, " /y ", true) == 0) if(strcmp(cmdtext, " /z ", true) == 0) Basically, I want to ...
0
votes
1answer
137 views

Unable to match using regex negative lookahead? [closed]

I want to match the following string using regular expressions in Java: suspicious url test' xts#dfd I don't want the regex to match if there is a quote, (') This is what I'm using. suspicious ...
-2
votes
1answer
66 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 ...
1
vote
2answers
641 views

vim submatch - trying to put quotes around a string

I'm trying to use the vim submatch command to put quotes around all strings of characters in a line of text, and it doesnt work. Here's what I'm doing :s:\a*\a:\(submatch(0)\):g All it does is ...
0
votes
1answer
364 views

unclear as to what submatch does in vim

Im unclear as to what the submatch({nr}) expression in vim does. The manual says the following: submatch({nr}) *submatch()* Only for an expression in a |:substitute| command. ...
3
votes
1answer
2k views

Microsoft Office Word 2010: How to “Find and Replace” an entire line using “regular expressions” (wildcards)?

I would like to "Find and Replace" entire lines in Microsoft Office Word 2010 which match some criteria. I tried to find the solution in the official documentation, but I didn't find the answer: ...
0
votes
1answer
149 views

Remove every second carriage return starting from line two

I have a text file where I'd like to remove every second carriage return starting with line 2. So the carriage return should be removed in lines 2, 4, 6, etc. The carriage return can is ...
1
vote
1answer
59 views

Matching html paragraphs with at least one word in all caps

Using regex or anything, I need to match any paragraph which contains at least one all caps word. Then transform it into a header and capitalise all the content of the title. In the example below, ...
0
votes
2answers
512 views

NOTEPAD++ REGEX - I can't replace what I find with nothing

Here is my regex statement which works great and highlights what I'm looking for in notepad++ (?<=thd)(.*)(?=]]><\/g_n>) But when I try to replace it with nothing aka an empty line or a ...
1
vote
1answer
69 views

Gedit gktsourceview3.0 rules - multiple optional suffixes

I'm trying to write a syntax highlighter rule for arm assembly to use in gedit. In arm, every command has some optional suffixes which make it execute conditionally. So obviously I want the command ...
0
votes
2answers
47 views

How to grep a number following a keyword from a textfile?

How to grep the member id X01930 from the following file? Blah Blah ... Blah Blah Blah Blah ... Member ID: X01930 Blah Blah ... Blah ... Blah Blah ... Blah The string Member ID: is usually there, ...