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
7 views

Adding specific line after findinga pariticular line

I have huge codebase containing 400-500 files. In most of the files we have this kind of lines, <cfcatch type="any"> / <cfcatch type="database"> / <cfcatch> etc. So the common ...
-4
votes
1answer
30 views

Regex between two patterns that matches only the first occurence of the second pattern

I have the following text: 676 ##$a610$v22 <coded_13></coded_13> 700 #1$3184149134rtrtrtrtrtrtrtrt$4210 <coded_27></coded_27> ILeclerc, Michel (1952-....) ...
1
vote
1answer
37 views

Batch: Return the matching lines from pipe's output to the console with regex

I have the following domain checking bash script in Linux: #!/bin/bash TLD='.com' while read -r domain; do whois -H $domain$TLD | grep -oPaq '^.*(Creation Date|record created).*$' if [ $? -eq 0 ...
15
votes
5answers
70k views

Matching only the first occurrence in a line with Regex

I am completely new to regex and I would greatly appreciate any help. The task is simple. I have a CSV file with records that read like this: 12345,67890,12345,67890 12345,67890,12345,67890 ...
-3
votes
2answers
18 views

I need help building a regex for a grep to show only the path to running versions of java

I need help building a grep from ps -ef to return only java paths. Say we have the following runnning process: bash> ps -ef | grep java user pid# 1 1 00:00 ? 00:04:00 ...
0
votes
0answers
12 views

Efficient Find/Replace Heading in MS Word that Contains text

I have multiple Heading 3s in MS Word. Some of them contain specific text: "MYTEXT". I want to find all Heading 3s that include "MYTEXT" and remove that word and all text to it's left while ...
0
votes
0answers
8 views

Regex: Define multiple whois servers for a single TLD in whois.conf

A single TLD is defined by this way in whois.conf for GNU whois: # whois configuration file # # This file can contain details of alternative whois servers to use if # the compiled in servers are not ...
2
votes
3answers
9k views

Extract/delete all other text than whats inside quotation marks (“ ”), and after string

I'm have a very big data output in a .txt file that looks like this: value1="1",value2="2",value3="test3",value4="4" value1="1",value2="2",value3="anothertest3",value4="4" ...
0
votes
1answer
17 views

Can I use grep to pull out a particular pattern from a file / number of files, using regex perhaps?

I have a file with a load of errors in it. I used grep to pull out all the JSONExcpetion Errors and save them in a new file like this: sudo grep -Hrn "JSONException" 2016-* >> jsonexception.txt ...
0
votes
1answer
16 views

regexp search and replace for bash variables

A number of my bash scripts need tidying up before sending them round. One of the thing I would like to do is to use curly braces for all variable names. So everywhere it says $PWD should be changed ...
0
votes
2answers
67 views

Extracting named groups of regular expression in LibreOffice Calc

In Python 3, it is quite easy to extract text from named groups as shown in the following example: import re myStr = r"4000/2000/5000/7000" reObj = re.compile(r"""(?P<g1>\d+) # a capturing ...
1
vote
1answer
16 views

RegEx with Word 2013. Match string AFTER known word to End of Line or <table>

I'm using the Find and Replace feature in a large word document I have. I need to find the word REMARKS: (all bold and upppercase). REMARKS: THIS IS SOME IMPORTANT DATA At then end of that line ...
0
votes
1answer
91 views

Transform a CSV with Notepad++

Suppose I have a CSV file like this: 1,"abc",,,, 2,"def",,,"ghi", 3,,"jkl",,,"mno" Now I need to transform it in 3 steps: Replace all empty spaces with the String NULL Add at the beginning of ...
1
vote
3answers
32 views

Notepad++ regex not working

I am trying to use Notepad++ and regular expressions to remove all XML from Windows' events. My regular expression is as follows: Event Xml:(.|\n)+?Event>\n Example Windows events are as ...
0
votes
2answers
34 views

How can I delete everything else from my txt except hungarian texts?

I have a localisation file from a game, and unfortunately, this file conain all localized language, but I only need is, the hungaryan texts from them. I would like to make a video series from this ...
-2
votes
0answers
43 views

Notepad ++ (REGEX); Invert Selection,

Notepad ++ (REGEX); Invert Selection, The following 2 different codes, it works very nicely. :) now I want to combine these two different code! \bhttps?:[^)''"\s]+.(?:jpg|jpeg|gif|png) ...
0
votes
0answers
14 views

Automatically Monitor and Rename Files with Regex

Is there a tool that allows you to monitor a folder for new files and apply a regular expression to automatically rename the files?
0
votes
0answers
10 views

Possible to use RegEx and Notepad++ to compress repeated words to word counts

I would like to use NotePad++ Find and Replace with RegEx to essentially compress data in a text file. I have data which contains repeated adjacent words such as: [dog][cat][cat][dog][cat] I would ...
1
vote
2answers
2k views

How to search and replace any digit at beginning of an MS Word paragraph?

Trying to do a find a replace on any paragraph that begins with a number. Tried this in Find and Replace: Find what: (^13)(^#) But get the error ^# is not a valid special character for the ...
26
votes
6answers
8k views

Substitution in text file **without** regular expressions

I need to substitute some text inside a text file with a replacement. Usually I would do something like sed -i 's/text/replacement/g' path/to/the/file The problem is that both text and replacement ...
-2
votes
1answer
14 views

How to find & replace a pattern with string in ruby?

My file is: [root@test etc]# cat nrpe.cfg command[check_users]=/usr/local/nagios/libexec/check_users -w 30 -c 35 command[check_load]=/usr/local/nagios/libexec/check_load -w 15,10,5 -c ...
2
votes
1answer
21 views

Bash Regex oddity when using =~ operator

Consider this code: s1="1,2,3,4"; \ s2="1,2,3"; \ sP='^(([1-9][0-9]{0,},){1,2}){1,2}$'; \ [[ "${s1}," =~ $sP ]] && echo "\$s1 matches"; \ [[ "${s2}," =~ $sP ]] && echo "\$s2 ...
2
votes
3answers
2k views

What's is the easiest way to append ';' to the end of lines which contain the char ':'?

I have a text file, whose content is like: body font-size: 12px color: blue td font-size: 14px ... I want to append ; to the lines which contain :, so the content will be: body ...
0
votes
1answer
12 views

Which of the following use of anchor is correct in regex using grep?

Both of the below commands gives the same output, however which one is the correct method to use it? grep ^'\<that\>' file.txt Searches for the line which has that as the first word grep ...
0
votes
0answers
32 views

JFlex: multiline string literal (multiline bash commands)

I use JFlex to describe a file format. It uses a literal string to describe the multi-line commands (as in bash). I do so: STRING_LITERAL= "\"" ([^\"])* ("\\\n"|"\"")? Text example: CMD "git ...
0
votes
0answers
27 views

fail2ban does not ban IP although there is one failed regex in table

I don't know why fail2ban not adding the bad ip into iptables rules. Here is my setup. /etc/fail2ban/filter.d/http-get-dos.conf [Definition] failregex = ^<HOST> -.*\"(GET|POST).* ignoreregex = ...
1
vote
1answer
5k views

Perl for matching with regular expressions in Terminal?

I'm trying to familiarize myself a little with Perl to use for regular expression searches in Terminal (Mac). Now, I'm not really looking to learn Perl rigourously, just trying to find out how to do ...
0
votes
0answers
18 views

Notepad++ If a line contains a word replace line a certain distance below with a phrase

I'm pretty sure this is possible, and I think it involves Regex, but I have no clue how regex formatting works, and I haven't been able to find the expression I'd need anywhere yet. Basically I've ...
3
votes
2answers
30 views

Notepad++ RE Search and Replace

Can someone explain why the following record: 1234 4567 blahblahblah becomes blahblahblah When Search/Replace applied (NP++ v6.9) with: Replace:^\d{4}\h with:(nothing) (Reg Exp) radio on Any ...
0
votes
0answers
14 views

How to use RegEx modifiers within Ultraedit?

I'm looking for using regex modifiers like (/g global, /s single line, ...) on UltraEdit. I want to use them when applying Find/Replace on my files using UltraEdit. Note: I'm using UltraEdit for ...
0
votes
0answers
7 views

Pattern finding application that generates regex?

I am building rule sets to recognize weak passwords, to do this quicker, I am thinking I will take a cracked password word list from https://hashkiller.co.uk/downloads.aspx and run it through a ...
0
votes
0answers
25 views

Disable emoji icons in Chrome?

I want to disable emoji in Chrome, or replace them with something else (not for any particularly deep reason - figured it'd be amusing). I'm using an extension called Word Replacer II, which allows ...
3
votes
1answer
19k views

.htaccess 301 redirect with regular expressions

If I have: redirect 301 /users/foo http://www.example.com/profiles/foo redirect 301 /users/bar http://www.example.com/profiles/bar Can I do something like? redirect 301 ^\/users/(.+)$ ...
0
votes
1answer
100 views

Is there any way to save a search in Xcode or OS X?

I want to improve my workflow by having a saved search that I can either simply open, or would automatically update. For my current particular use (may change in the future), it would search the ...
0
votes
1answer
30 views

How to find wild card value and append to it

I have part of the hundreds of lines similar to : [vc_single_image image="55"] How can I change the lines so they all get appended img_size="full", resulting in [vc_single_image image="55" ...
2
votes
1answer
50 views

Dreamweaver Regex - Unmatched ) in regular expression

The Issue The issue I am tackling is that past developers of some code I am working on set variables like $_GET[name] or sometimes like $_GET['name']. Trying to make the code uniform, I want to make ...
1
vote
2answers
397 views

Match multi-line pattern in Charles proxy rewrite rule

In Charles proxy, I'm trying to use a rewrite rule to match a pattern that spans three lines in a response body, using \s* in the Match value (with 'Regex' checked) to match new lines. It appears ...
0
votes
0answers
9 views

.htaccess to hide 2 possible directories

I am having difficulties getting the second statement working regarding admins, i am trying to hide both new and admin parts of the directory. new seems to be hiding fine however admin doesnt want to ...
2
votes
1answer
52 views

How To find a word and replace with changing pattern

I have a text like the following: case "UID": if (!Convert.IsDBNull(objDataReader["XYZ"])) { objQualitativeAssessmentBiz.XYZ = objDataReader["XYZ"].ToString(); } break; case "GeneratedChaseId": ...
0
votes
0answers
16 views

Dreamweaver REGEX trying to find and replace (or remove)

So far am using this: "http([^>]+) as my REGEX. The page has multiple urls mixed with text and DOM Elements. Something like: <li><a href="http://www.uen.org/toolbox">UEN's Teacher ...
-1
votes
1answer
42 views

Notepad ++ - How can I replace a line using a column from next line

So the problem is that, I have a really huge file of clients and I need to do this: example1.1@hotmail.com example1@hotmail.com;12345 Became this: example1.1@hotmail.com;12345 ...
1
vote
1answer
55 views

exclude specific strings of words using wildcards

I cannot seem to come up with the appropriate wildcard (I suppose it must be [!]) which would exclude from the expression argument[oales]{1,4} the following three words argumentos argumenta ...
6
votes
2answers
18k views

Notepad++ regex Replace, using match variables

In Notepad++, I want to perform a find-and-replace, providing a variable in the 'Replace with' field, which references a match from the 'Find what' field. Any ideas? I tried supplying (find) foo (\w) ...
7
votes
5answers
80k 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 ...
0
votes
2answers
69 views

Notepad++ - replace every first space of a line

I know there are a lot of these types of questions but I can not find a way to alter one of the existing solutions for my problem. My text file looks like this: ...
10
votes
5answers
4k views

Can I use perl regular expressions in the vim command line?

I want to use perl regular expressions on the vim command line. For example, to capitalize the words on the current line, you could type: :s/(\w+)/\u$1/g
0
votes
0answers
33 views

Replace using Regex in Notepad++

I want to replace every occurrence between <fb:like href= and </fb:like> in notepad++. I know I can do this with Regex, but i tried for a couple of hours in vain. I have to do this in a ...
0
votes
1answer
23 views

Regular Expressions: Assertions

I would like to know what the definition for an assertion is in the context of regular expressions. If anyone should know, please enlighten me with a brief definition of what it actually is. I would ...
0
votes
2answers
27 views

Notepad ++ find and replace issue

I have had some luck with notepad ++ solving some complex find and replace a lot of similar text in around 8000 documents, but not this particular one: In a text file I will have a lot of lines that ...
34
votes
6answers
19k views

How can I search for regular expressions within webpages using Google Chrome or IE?

How can I search for regular expressions like 'foo|bar' on webpages using Google Chrome or IE? I'm aware of the "Regular Expression Searcher" extension, but it does not work for me. (Nothing happens ...