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
2answers
1k views

VI make every first letter that comes after a underscore uppercase

Found this site: http://unix.t-a-y-l-o-r.com/VMswitch.html And it works for the first character but my lines are line this this_is_a_string And I would like this This_Is_A_String Any ...
1
vote
1answer
3k views

How do I use regular expressions in TextMate's find dialog box to search and replace?

I want to replace all the \caption(.1..) \caption(.2.) \caption(.3..) \caption(.4..) by \caption{} What should I put in the search box?
1
vote
2answers
42 views

insert a string between two patterns

I would like to change file with name like: d1-a2_A1_B1.txt abcd_A90_B2.txt where I want to insert _FOO in between first _A[0-9]\+ and _B[0-9] so the file names becomes d1-a2_A1_FOO_B1.txt ...
11
votes
6answers
11k 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 Find/...
19
votes
10answers
69k views

What regular expression can I use to match an IP address?

With the following grep syntax I want to match all IP address in a file (from a ksh script) grep '[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}\.[0-9]\{1,3\}' file The problem: It also matches words (...
1
vote
2answers
46 views

grep: return NULL if false

I'm trying use grep to extract attributes from a large collection of XML files. I've tried usinggrep -E -m 1 -o -Z "<tag>(.*)</tag>" /home/somepath/*.xml || printf "NULL" but for some ...
0
votes
1answer
33 views

Specific use case for wildcards in Notepad++

I'm trying to prep HTML code for further editing in WYSIWYG editor and I want to simplify the process as much as possible. Here's an example of my string <p>C P U xxxxxxxxxxxxxxxxxx</p> ...
0
votes
1answer
22 views

validate a mysql regular expression

I have a php5 app which performs mysql searches, and I give the user the possibility to enter a regular expression to use with RLIKE. I want to be sure that the regular expression is valid, in order ...
2
votes
1answer
35 views

Why does the regex in find not return any results?

The command find . -maxdepth 1 -regextype posix-egrep -regex '.*/[a-z0-9\-\_\.]+\.(gz|deb)/' -exec echo {} \; yields no results in a directory containing the following files: google-chrome-...
2
votes
1answer
67 views

Replace a nested LaTeX command with multiple arguments

I'd like to replace the LaTeX command \teilseiten{left col width}{left col text}{right col text} by an nested environment. The problem is, that the second and third argument of \teilseiten contains ...
1
vote
1answer
41 views

find and replace 4 characters or columns from end of line

I have a large database with text and 4 digit numbers: wide receipt 5245 seacrest john mason field - rogue 5524 charly rose/flower - return deemed creed 7532 I want to sort them so that the ...
1
vote
1answer
24 views

Replace a line with a specified pattern

As shown in the example, the number 1 appears in the same column in every line, and in my file, there are 6000 lines like that in total. 1. 1 2. 1 3. 1 4. 1 5. 1 6. 1 7. 1 8. 1 9. 1 I want to ...
1
vote
2answers
380 views

Remove/Change specific Html tags NotePad++

i have found many similar posts, but non of them answers my question. I would like to replace/remove/change open and close tag with a specific key word. in this case i am trying to remove all tags ...
2
votes
1answer
328 views

unknown exception error when I run Notepad++ v6.8.2 when starting Regex Helper

I get an unknown exception error in Notepad++ v6.8.2 when starting Regex Helper? Any suggestions? OS: Win7 64-bit Installed with installer package
1
vote
1answer
67 views

Find and replace first digit with notepad++

I have a bunch of numbers like this: 001 001 002 002 002 003 003 003 003 all the way up to 100. using the search and replace is there a way to just change the first number so that i could get it up ...
0
votes
1answer
73 views

Pad a regex capture group?

Is there some way to pad single digit numbers with a 0 with regex? I'm using Python. 6 => 06 1 => 01 etc. Here's what I'm working on: https://regex101.com/r/iG9qC7/1 I'd like all the file names ...
2
votes
2answers
2k views

Notepad++ - How to remove everything after the last backslash “\” on a line in a text file

I have a list of about 30,000 files (with paths) that need to be individually copied along with their folder structures. Unfortunately, the paths are very long and the file copy utilities that will ...
1
vote
0answers
35 views

How to properly match newline with zsh regex?

for my prompt i am trying to parse the current git branch out of the resulting text of the git status command. For example, it returns: On branch master nothing to commit, working directory clean ...
0
votes
1answer
120 views

How do I escape a dot / period in bash string match

This is my first post, and I am really appreciating all the answers which helped me so far on that website, I hope this is not a redundant post, but I couldn't find something similar here. I try to ...
0
votes
3answers
138 views

Greedy match in MS Word regular expression?

I need to clean up some tables in Word, where semicolons and text after them is redundant, e.g. text1 ; text 2 where above is a content of one cell and I need to remove semicolon and everything ...
0
votes
0answers
20 views

Comman line alternative of Notepad++ regex [duplicate]

I Have .rtf file in which I generally do Notepad++ regex find and replace then and bookmarks and then copy/remove bookmarked line. My find strings contains following types of elements Search ...
1
vote
0answers
83 views

Regex to find commas, excluding commas inside a string demarcated by double quotes

I would like to manipulate a closed .csv file without opening it through a button on an Excel AddIn. I am able to complete all the steps but am having a problem with finding a regex that would ...
0
votes
1answer
28 views

Save text from file between two given characters and save the output to file?

I have a file with the following kind of text: @ heading with some text the.actual.text.of.choice which.can.be.several.lines in.length.with.no.pattern + more.text.that.i.want.to remove.several.lines....
2
votes
1answer
895 views

How to extract email ids from a document using Word or Writer

I have a document(.doc) with hundreds of email id's in it placed randomly in the text. How do I isolate the email ids, so that I can export them to my Gmail Contacts? I would like a solution to this ...
0
votes
1answer
36 views

RewriteRule not redirecting to specified URL

Here is my rewrite rule: RewriteRule ^rest/v(?:[0-9.]+)/((?:[A-Za-z]+)/(?:[A-Za-z]+)(?:/(?:[A-Za-z0-9])+))?\.(json)$ https://localhost/rest/v1/index.php?url=$1&type=$2 [QSA,NC,L] It’s something ...
1
vote
1answer
54 views

How to replace text between two unique strings in file?

In requirements.txt, I want to replace the branch/commit which can contain forward slashes, dashes, and other potentially special characters that may need escaping: -e git@github.com:acme-inc/repo0....
0
votes
1answer
78 views

In excel 2010, substitute any number corresponding to pattern with look-up value

I'm trying to figure out a way to replace/substitute/regex a specific pattern in an Excel table with the corresponding value from another table. The pattern, which appears x times inside a text block, ...
0
votes
1answer
30 views

text editor-style renaming of filenames in directory

How can I edit the names of files in a directory as though I were editing the text of a file using a text editor? I feel like I've seen this demoed in a video, perhaps using some Vim plugin or ...
0
votes
1answer
35 views

tweaking a regex in Notepad++

I need to create a regex for Notepad++ for the below expression, when the text of "Letter to Mary"changes {\par\pard\qc \b Letter to Mary °\par\pard} I tried the following but it is not working \{...
0
votes
1answer
42 views

regex expression for two digit numbers

I need to create a regex for Notepad++ for the below expression. However the two digit numbers (for example 24) always change. How should it be the expression? {\cf2 \super (24)} it does not work ...
1
vote
2answers
132 views

Need to add missing iteration id numbers to a series in text or excel. How to get this done without coding?

I have a text, csv or excel file that looks like ||--ID-----||--Name--||--Date of birth--|| 1 Jo 1/1/11 32 Mo 2/2/12 3382 Ro 3/3/10 ...
5
votes
5answers
398 views

Copy file names with a certain number of characters in command line (CMD)

I need to copy all text files on one folder whose names are five characters long. I know this command is for listing: $ dir folder /B | findstr /R "^.....\.txt" but I want to copy all files whose ...
1
vote
2answers
38 views

How to select or remove everything outside of : :

I need some help with notepad++ and RegEx. I looked for some answers already, but didn't find or understood them. I basically have lines that goes like.. user:$2y$10$Bst0pYRdnpe9kBWTYj925u....
6
votes
2answers
2k views

Is there a command in Mac OS X that can perform multiline regex searching?

I want to do a simple regex search recursively through a directory that isn't restricted to single lines. I tried grep and ack, but neither seem to support this. I know it shouldn't be too ...
1
vote
1answer
39 views

Generate CSV from NS Zone File

I have a large file that contains records in multilines. ex: domain1 NS ns1 domain1 NS ns2 domain1 NS ns3 domain2 NS dnsx What might be the fastest way to generate a CSV of the form domain1,ns1,...
0
votes
1answer
151 views

Regular expression for find in files in Textpad

I want to use regular expression for find in files in TextPad. I need to find URLs starting with "Areas/" and ending with "/pdf"(something like this Areas/../../...pdf). Please suggest me the correct ...
0
votes
1answer
79 views

Replace nth element of list with regex

I have a file with lists of strings separated by semicolons, like this one: aaaa;bbb;ccccccc;dd; eeee;fff;ggggggg;hh; iiii;jjj;kkkkkkk;ll; and am looking for a regex expression to replace the ...
0
votes
1answer
133 views

Regexp engine misbehaves in Atom

I'm trying to remove all lines starting with whitespace characters from a big text file using Atom. The regular expression I use is ^[\s]+.*$. The problem is, it selects not only lines starting with ...
1
vote
2answers
974 views

Mass renaming files, removing dots

I want to rename files as to delete unneccessary dots. ie: File.something.jpg -> Filesomething.jpg I.Have.Too.Many.Dots.png -> IHaveTooManyDots.png How can this be done? find -name *.*.* ...
7
votes
1answer
161 views

How can I search and replace a variable in Linux?

I have a bunch of files with lots of rows configured like this: what,r-crq,What,What,VAC5700-035080,What i,pns11,I,I,VAC5700-035090,I do,vdd,did,did,VAC5700-035100,did I want to do a search and ...
5
votes
2answers
2k views

How to install regexp enabled 'rename' on fedora?

I have a batch rename task and I find the 'rename' command in Ubuntu and Fedora is different. In Ubuntu, rename is written in Perl and has regexp support. Is there anyway to install it on Fedora?
1
vote
1answer
62 views

Using regex in BASH script to grab filename/type recently created as output by command earlier in the sequence

I recently asked This question about the use of gpaste getoutput as STDIN for youtube-dl. That question has since then been answered, but I would like to move on to the next step of automation a multi-...
0
votes
0answers
27 views

How to use TextMate 2's Find “In” Regular Expressions?

Ok, here is a scenario, in pictures. OK, so searching all files looks in 333 files, and finds 614 matches. First result is alex/init.zsh. Fine. So I try to limit the scope a bit, with my logical ...
0
votes
1answer
272 views

Extracting lines from a large text file which follows a pattern

How do i extract lines from a text file which satisfy this regex ^2. I am using linux. I know grep is able to extract the number of lines but i would need them to be output to a text file. Is it ...
0
votes
0answers
38 views

Outlook Query to highlight messages that mention me?

In essence, I want to do some conditional formatting on messages that mention me. Below are 3 sample Messages (Bodies). The first two should be purple, the last one should not be purple because I ...
0
votes
1answer
87 views

Printing matching subgroups in a perl one liner

I have the regex[1] (/foo/bar/(GW|GREV)[^/]*).* I was able to get this to work with GNU sed with sed -n 's/\(\/foo\/bar\/\(GW\|GREV\)[^\/]*\).*/\1/p' But that was a modern GNU sed and I'm on ...
1
vote
1answer
633 views

Replace variable in string with Regex in Notepad++

I'm new to Regex and Notepad++ need to remove variables from code. For example, remove everything between the double quotes in lines like this: alt=""Frontline Plus for Dogs and Cats"" To leave me ...
1
vote
1answer
105 views

How to find the missing number in a sequence

I have a Holy Bible file which starts every line with a verse number (e.g. 1, 2, 3, 4) and so on. But on certain chapters some verses are skipped or are not present, for example 10, 11, 12, 14, etc. ...
0
votes
0answers
38 views

insert text and numbers in notepad++

I have this: ...something...data-src="TEXT"...something...src="images/BBP/BBP0001/01SMALL.jpg"...something... ...something...data-src="TEXT"...something...src="images/BBP/BBP0001/02SMALL.jpg"......
3
votes
2answers
86 views

Word 2010 wildcard search - Find text in format ABC.DEF.XYZ

I am trying to find text in Word 2010 in the following format: ABC.DEF.XYZ. This is essentially finding code references, using Java syntax, written into the word document. Please note that a 3-...