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)

6
votes
3answers
7k views

Windows: File copy/move with filename regular expressions?

i basically want to run: C:\>xcopy [0-9]{13}\.(gif|jpg|png) s:\TargetFolder /s i know xcopy doesn't support regular-expression filename searches. i can't find out how to find out if PowerShell ...
2
votes
6answers
2k views

Editor with muti-line search and replace

I am looking for text editor for Windows which is capable of performing search and replace operation of multi-line text block. It should be able to run this operation on a folder or currently opened ...
21
votes
10answers
17k views

Renaming many files in Mac OS X, batch processing

I used to rename file in Linux via a rename command: rename 's/old_pattern/new_pattern/g' *glob Is there something similar in Mac OS X (Snow Leopard)?
10
votes
4answers
26k 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 ...
9
votes
5answers
759 views

Is there software to allow me to search a PDF file with Regex?

I would like a PDF viewer that I can search documents with using regular expressions. Is there such a thing? I've tried PowerGrep, but it doesn't have a graphical viewer and its interface is a little ...
8
votes
3answers
12k views

Grep multiline pattern

How do I search for a phrase over multiple lines? E.g. Lets have the phrase "my ice tea" then it may be wrapped in text files: as js skdfh dfh djh sf my ice tea. grep will not match since there is ...
3
votes
2answers
4k views

Export all regular expression matches in Textpad or Notepad++ as a list

In Textpad or Notepad++ is there an option to export all the matches for a regular expression find, as a single list? In a big text file, I am searching for tags (words enclosed in % %), using ...
6
votes
1answer
2k views

Regex for “or” of multiple words in grep

[Computer]$ grep "foo|bar" filename I understand the above command should return each line in filename where there exits "foo" or "bar". The man pages confirms | as the Regex or symbol and the code ...
0
votes
0answers
119 views

XML text transformation

I have a large file part of which is like below: <DataGroup xsi:type="ReportDataGroup"> <SmartReportTemplate DescriptionContentType="text/plain" IsActive="true"> <Name ...
15
votes
5answers
7k views

Grep tool for XML

I am looking for a good tool to perform grep-like operations on XML - for example, extract certain attributes only. Grep itself can't handle it - any DFA-equivalent tool can handle only non recursive ...
10
votes
1answer
3k views

vim delete all lines that do NOT contain a certain word

In vim I can delete all lines that contain the word "price" with this :g /price/d How can I delete all lines that do NOT contain the word "price"?
9
votes
4answers
5k views

Newlines in sed on Mac OS X

I find that \n doesn't work in sed under Mac OS X. Specifically, say I want to break the words separated by a single space into lines: # input foo bar I use, echo "foo bar" | sed 's/ /\n/' But ...
5
votes
3answers
16k 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, ...
4
votes
1answer
265 views

Simplest setup on Windows to send HTTP request, get and apply regex to response, and write match(es) to output file

I'd like to write a script that records the size of the close votes review queue on SO (currently ~95.5k), polling just a few times an hour, so I could plot a general trend. I know what I'm going to ...
19
votes
4answers
12k views

Is there a linux command like mv but with regex?

For example I want to mv (.*?).sql $1.php, is there a command that lets me specify renaming patterns?
10
votes
6answers
3k 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 ...
6
votes
3answers
5k views

Use Notepad++ to change under_score_case to CamelCase?

I can write a regular expression in NP++ to find under_score_case. I can use TextFX in NP++ to change case to upper and lower case by highlighting and selecting. How can I use either NP++'s ...
4
votes
1answer
752 views

Search using regular expression in a browser?

is there a way to search within a browser (with any of them) using regular expression? Let's say I want to search for either "python" or "php" I don't want to have to do this twice. Ideally, this ...
3
votes
3answers
776 views

Deleting Duplicated Lines In TEXT File?

I am trying to cleanup a text and for some reason every line duplicated 3 times am i able to get ride of duplicates with regex or tricks or do you know a software which could do that , text file is ...
7
votes
1answer
1k views

regex edit in skype?

Ok, I am not a big skype user, but I was chatting with my sister, made a typo and habitually typed tpyo s/tpyo/typo/ to my surprise it actually changed the history. I am using the linux skype ...
5
votes
2answers
783 views

grep - match anything but given filetype

I want to clean out my music library so I don't get any more "search for suitable plugin" messages from Rhythmbox when it sutubles across some WMA-Relic. I have the tools, but now I want to FIND ...
3
votes
1answer
6k views

Windows 8 Registry Permission to change values

Since Windows-8 I'm unable to change values in the registry (different customizations) like changing the explorer menu. Anyone able to change the value of the key 'Attributes' in the following ...
8
votes
1answer
1k views

How do I include newlines in a search in less?

How can I search for newlines (or end of lines) as part of a search using less? For example, I'd like to search for length=9\n, but don't want to merely search for length==9 because that'd get ...
8
votes
5answers
3k views

How is \$ being interpreted by grep?

When I write $ grep \$ then whatever I type on terminal, is matched and printed on terminal. How is \$ being interpreted?
4
votes
4answers
5k views

rsync using regex to include only some files

I am trying to run rsync to copy some files recursively down a path based on their file name pattern, case insensitive. This is what I have done to run rsync: $ rsync -avvz --include ='*/' ...
3
votes
1answer
646 views

Regex in Notepad++ 6

So, Notepad++ got updated to v6.0. One of their new features is PCRE (Perl Compatible Regular Expressions). I tried to use this new feature to find and replace things in a file. I tried the regular ...
2
votes
2answers
5k views

Sed only print matched expression

How to make sed only print the matched expression? I want to rewrite strings like "Battery 0: Charging, 44%, charging" to "Battery: 44%". I tried the following: sed -n '/\([0-9]*%\)/c Battery: \1' ...
2
votes
4answers
1k views

How to find the line with the maximum number of columns/characters in Vim/gVim?

I'm currently using gVim on Windows XP, and I have 2 follow-ups to my core question: What is the best method of finding the line with the most characters? My current method: I use the regex search ...
2
votes
2answers
6k views

Notepad++ Search & Replace with Regular Expressions

I know its simple, but I can't get it to work... I have a strings like {span style="display:none"}123{/span} and {span style="display:none"}456{/span} and {span style="display:none"}789{/span} ...
1
vote
2answers
2k 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 ...
1
vote
2answers
153 views

How do I list every other file extension using regex on Linux?

I have the following command which lists all files that have the extension .swf however I would like to return a list of every file that does not have the extension .swf find . -maxdepth 1 -regextype ...
1
vote
2answers
1k views

Is there any pdf reader that supports word searching with regular expression? [duplicate]

Possible Duplicate: Is there software to allow me to search a PDF file with Regex? I sometimes would like to search some particular words in a PDF file, however there are always a lot of ...
1
vote
3answers
804 views

What is the easiest way to do PCRE-style regexp search/replace for MS Word?

You can do this by cut+paste to another RTF editor that supports them, but this does all kinds of horrid things if you want to reimport the text, like mess up tracked changes. Is there something like ...
0
votes
1answer
106 views

Show starting with a special line until a special line regex for Linux tail command

I use that notation at my log files: [something-something] somethings are necessary and variable length characters and numbers. My special log file includes line that has characters explained above. ...
0
votes
1answer
130 views

How do I create a shortcut for a find and replace command in vim?

I have a vim (well, sed really) find and replace pattern I use for resetting the AUTO_INCREMENT property in mySQL CREATE TABLE statements: :%s/AUTO_INCREMENT=[0-9]*/AUTO_INCREMENT=1/g I use this ...
0
votes
1answer
740 views

Why doesn't my regular expression work in NotePad++? [closed]

Why doesn't <example regular expression here> work in NotePad++?
0
votes
1answer
62 views

Searching Multiple Terms

I know that grep -E 'termA|termB' files allows me to search multiple files for termA OR termB. What I would like to do instead is search for termA AND termB. They do not have to be on the same line as ...
-1
votes
2answers
99 views

Show matched lines for a given regex at Linux

I use that notation at my log files: [something-something] somethings are necessary and variable length characters and numbers. My special log file includes line that has characters explained above. ...