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
1answer
9 views

How can I find & replace a comma with a space when it appears in a certain pattern?

How can use find and replace in Notepad++ to find all instances of the following pattern, and replace the comma with a space? (I'll write it out, and then show and example.) 2-digit number colon 2-...
0
votes
2answers
27 views

How do I reverse the order of log entries in this file? (Vim for preference)

I've got a set of files that contain notes written in reverse order: ###### 27/07/2016-15:04:20 GMT+1: Really? More? ###### 27/07/2016-15:04:18 GMT+1: It happened again! ###### 27/07/2016-15:04:...
1
vote
1answer
20 views

Get part of string that matches regex

I'm writing a bash script and trying to parse a file to get a software version. The output is : Version 13.0.R7.0 - Built on Tue Feb 09 18:47:29 EST 2016 I want to be able to pull out 13.0 (I will ...
-1
votes
1answer
33 views

Add character at a position to a string with notepad++

How do I insert a character into a string at a given position in Notepad++? For example 00000000 to 000000-00
0
votes
0answers
10 views

sudoers entry regex possible here - and file membership

i.e. from man sudoers I got the info When multiple entries match for a user, they are applied in order. Where there are multiple matches, the last match is used (which is not necessarily the most ...
0
votes
0answers
7 views

Devmon exception template to alarm only if ifAliasBox contains string “uplink” (for Xymon)

to monitor my network I use Xymon with Devmon SNMP crawler. Devmon is a perl program for extracting and interpreting data received from SMNP capable devices. Therefor templates are used for each ...
1
vote
0answers
8 views

How can I perform regex searches over secured PDFs?

I want to do regex searches over the Air Canada Timetable PDF file (available here). Unfortunately, the file is secured, and that seems to prevent many of the usual ways of doing regex searches over ...
-1
votes
0answers
36 views

Using sed to replace string with special characters in XML file - part 2

To continue the discussion about sed, variable strings and special characters, this works perfectly : sed -i "s~${LINE}~${NEWARGS}~" $FILES for the variable with contents of: JAVA_OPTS="$JAVA_OPTS -...
2
votes
2answers
36 views

notepad ++ regex end of line replace

I want to replace the end of a line on line with ';' but only on lines that do not already end in ';'. I came up with the following to put in the replace dialog Find What = '[^\;]\r\n' Replace ...
0
votes
1answer
52 views

Using regex to extract specific fields from css, using notepad++

I've got a css stylesheet on which I want to perform some analysis and it seemed like a good idea to use regex inside Notepad++. Now I find I can't write the regex and maybe it wasn't a good idea but, ...
1
vote
2answers
46 views

Converting C# Regex To PowerShell

Our Software department has a program that runs SQL scripts from a certain folder. I now need to replicate this functionality in PowerShell. C#: var commands = Regex.Split(sqlFileText, @"^\s*GO\s*$",...
0
votes
1answer
23 views

Having trouble with regex for Treesize

I'm trying to find all documents that contain the following symbols in their name using Treesize Pro's file search: # % : • For whatever reason, the normal wildcard search function won't process *...
0
votes
1answer
13 views

how to filter text file on the basis another text file.

I have two text files . One is wordlist and another one is file to be filtered. I want to remove or delete all the lines or links from the file if the line has any word from word list anywhere in ...
0
votes
1answer
19 views

List all regex matches, one per line of output

I know that I can find regex matches using egrep. My need is a bit more esoteric: I need to list all regex matches, one per line of output. So, assume a file containing the following: This is just ...
5
votes
2answers
134 views

RegEx string formatting in Notepad++

I'm pretty good in RegEx, but there's one thing I can't seem to figure out how it works. How would one search/replace in NotePad++ and make sure that the output has a fixed length, while the input ...
0
votes
1answer
36 views

Adding Single quotes at the beginning and end of each string

I want to add single quotes at the beginning and end of all the strings in the given list and each item should be separated by a comma in notepad++ ANAND GABRIEL INDIA LIMITED NARMAC MOTHER DAIRY ...
1
vote
1answer
26 views

Word, Regex for brackets, word, whitespace or lf

In Word, I would like to use the regular expressions to match "Po" followed by either a whitespace or end of line character. [[Policy.PolicyNumber]] [[Po [[Po John So in the above example I would ...
-2
votes
2answers
39 views

Using Notepad++ Regex to remove anchors

I've tried looking at other answers for this and my brain just explodes when I try and read anything on Regex, I just cant comprehend it, no matter how many times I read it, or how slowly. Im trying ...
0
votes
1answer
21 views

Regular expression not working as expected for special characters

I have a Wireshark capture and I'm trying to create a display filter [Wireshark documentation] that finds XML documents which contain the term @@ V? (at-at-space-V-questionmark). The documentation ...
1
vote
3answers
71 views

Notepad++ Find and Replace Expert Suggestion

I need help with Find and Replace in Notepad++. Example: $250 'Hello 1' Take '____' $500 'Hello 2' Take '____' $1000 'Hello 3' Take '____' Imagine there are thousands of these entries going up to ...
2
votes
2answers
79 views

How to split a big .txt file with \n and not \r\n

I want to split a .txt file. First, I opened the .txt file with notepad++ and I changed the EOLs from \r\n to \n. Then I wanted to split the file into 10 pieces and for that, I used a tool called ...
4
votes
1answer
22 views

Regex positive lookahead when lookahead data doesn't exist (PCRE)

I'm trying to match out a string which will have a format similar to the following: username=joe password='this! is a password with "quotes" and spaces#913 custom1 customd afd weirdhuh? custom1=...
0
votes
0answers
20 views

start scanning from next page number (incrementing page numbers of files)

I am scanning a couple of my notes. The are saved as note1.jpg,note2.jpg,note3.jpg and so on the scanning happened smoothly till note48.jpg, some how some thing at this instant went wrong and then now ...
0
votes
2answers
59 views

lnav not recognizing our logs. Custom format not seeming to be applied.

I am working on adding a lnav format to parse the logs of my companies java application. I am running into difficulty getting lnav to recognize them. Here is what my json format file looks like so far:...
0
votes
2answers
15 views

Find highest numbered files in directory

Scenario: A backup system creates rar archives and splits them in 100 MB parts. I would like to find the highest numbered files within this directory. For example in- and output: Input: ...
0
votes
2answers
55 views

bash regex for a file name

I'm really not that good with regex but I thought I'd be able to pull this off since it's not that difficult. I'm using find to see if any file that matches the regex exists in that dir. The string ...
-1
votes
1answer
28 views

limiting regex search range

I have a long list of words, characters, and new lines, how do tell the regex to only search the text between TWO EXACT WORDS on the list? This is what I came up with but it does NOT stop searching" ...
1
vote
1answer
24 views

Regular expressions in procmail

I have a problem with backscatter to randomly generated fake-from-adresses on a domain with a catchall. The fake-alias is using a scheme, using egrep with the regexp ^To:.*.[A-Z].[a-z].*[A-Z].[a-z].*...
0
votes
2answers
18 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
36 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-....) <coded_27><...
1
vote
1answer
47 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 ...
0
votes
0answers
21 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
13 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 ...
-3
votes
2answers
25 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 /path/to/java/...
0
votes
1answer
25 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
24 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 ...
1
vote
1answer
23 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
2answers
115 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
3answers
48 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
37 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 ...
0
votes
0answers
17 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
13 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 ...
-2
votes
1answer
15 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
26 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 matches,...
0
votes
0answers
39 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
1answer
15 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
47 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 = ...
0
votes
0answers
24 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 ...
0
votes
0answers
18 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 ...