Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [regex]

Also known as regular expression or regexp, a description of a set of strings, often used for searching and validating strings.

0
votes
1answer
20 views

Busybox filter string list

Consider I have a list like this: list='item1.service item2.service item3.target item4.service' I need to filter this list to get something as: item1 item2 item4 So, there are two things to notice:...
-1
votes
0answers
21 views

what Algorithm does Microsoft Office use for search and replace? [on hold]

i'm in faculty of computers and information and my professor who studied my algorithm ask us to know the Algorithm that used by Microsoft Word to search and replace the words. i do a search on google ...
0
votes
1answer
20 views

Replace all words that start with @ by another word

So, basicly, I need to edit something like this: @john TEST TEST TEST @andrew EXAMPLE EXAMPLE @geady JK JK JK and I need to replace all of them to get like this: @replaced TEST TEST TEST @...
0
votes
1answer
19 views

How do I delete text before and after 1 character

For example I have: Apple:123456789:pear watermelon:57952161354:kfc How do I delete the text that's before and after the ":" to get this: 123456789 57952161354
1
vote
1answer
52 views

Replace text at the first of the specific lines? Sigil or Notepad++ Regex

How can I replace text at the first of specific lines Example before: <p>– Your mother created a song?</p> <p>– She was a pianist.</p> <p>– Okay then, let us hear the ...
0
votes
1answer
32 views

regular expression help needed

I have a text of 8XX lines that look like this: id="**02_item2_02" duration="29" style="**joe" id="02_item3_01" duration="35.5" style="joseph" The text between id=" and style=" is never the same.  ...
0
votes
2answers
42 views

grep or other regexp to get value of output

How to use grep or any other tool to get a specific value in an output In the below output I need to get the value 255.00 in the line with Minimum: 255.00 (1.0000) A pattern like: ...
0
votes
1answer
23 views

Remove all lines that contain characters other than

I have a list of with words and unwanted characters hag-lawig ha waray katapusan / ¤ 8¨2Þ‹%·/ój An ngatanan nga makakita ha akon I want to remove all lines that contain characters other than a ...
1
vote
0answers
18 views

Notepad++ Regex help required

I have a several hundred thousand line XML file that is full of data I don't need. I'm looking for a way to bulk delete thousands of irrelevant lines and am aware this can be done through find-and-...
0
votes
0answers
8 views

AlienVault Setup & Configuration Using Syslog for network traffic

I am attempting to deploy an AlienVault instance and am a bit confused about tracking the traffic. I can see that i can set policies and alarms based on certain events and that i think i need to port ...
2
votes
6answers
441 views

How can I replace end line with fixed text when the next line begins with a defined set of characters?

I have several big files with some measurements. It looks this way: N 12344;PE 9.9999999;... #S 0 0 31 44 75 130 165 196... #S_+ "2 5 2 3 3 1 1 2 3 1 2 2... N 12345;PE 9.9999999;... #S 0 0 34 57 ...
0
votes
0answers
25 views

How to remove breaking lines between two strings delimeters

I would like to remove all type of breaking lines between two string delimeters basically by replacing any type of breaking line encountered between these two delimeters with a single space character. ...
3
votes
1answer
93 views

Notepad ++ complex pattern search

Hi i'm looking for a notepad++ regex pattern match in a text, and bring some replacements. But so far what I have come up with does not seem to work. Sample text: 1 blablablabla. blablnsnsnns, ...
0
votes
2answers
124 views

Remove everything except what is in brackets?

I want to remove all text except for [ and ] and what's between them.  How would I go about doing that in Notepad++? Example input: [A B C] bla bla text here [D E F] bla bla text here [G H I] bla ...
1
vote
1answer
27 views

How to include a double quotes mark into RegEx exclusion group in Excel UDF

With help of this Is there an Excel formula to identify special characters in a cell? VBA code and excel UDF, I am checking special characters in my csv file. Using this formula: =RegExCheck([@...
0
votes
0answers
30 views

GNU find with emacs regex - match character class a specific number of times

I tried using the command find . -regextype emacs -regex '.+[0-9]\{3\}' to find the file test100 with GNU find, but obtained no output, which should have worked according to this reference. Why did ...
0
votes
1answer
46 views

Regex find duplicate of partial string

Im stuck with regex command, to find duplicate of partial string. 1st problem: This is what I have in my file 1;0197CE75;BC702 2;01966666;BC702 3;018B9AC5;BC702 42;018B9E21;BC702 6;018B9AC5;BC702 ...
0
votes
1answer
44 views

Outlook 2016 - “Check Names” exact match

When writing a mail I insert a user ID into the address field and use the "Check Names" button to gather its corresponding e-mail address. I get a prompt that Outlook has found the ID multiple times. ...
0
votes
1answer
64 views

Using Notepad++, how can I add multiple suffixes to one prefix?

So I have a list of 3,125 inputs as such: fdfffff, fdffffd, fdffffs, fdffffa, fdffffg. Each input starts with fd but then a random combination of the letters f d s a and g to fill in the next 5 ...
0
votes
1answer
37 views

Delete lines which contain only + signs

I am trying to convert my html document to asciidoc. But result lines have weird + signs like these: ++ + Mandatory Relationship + * *many-to-many* – because databases don’t support this kind of ...
1
vote
3answers
54 views

Regex: Remove every two or more spaces between specific tags and leave just a space instead

I want to remove every two or more spaces between specific tags and leave just a space instead: For example: <p class="text_obisnuit"> The context of articles, stories, and conversations ...
0
votes
1answer
26 views

Regex: Select all from row except tags

I have this kind of rows. <li><a href="love-and-attitude.html" title="Love and Attitude">Love and Attitude (24)</a></li> <li><a href="paint-and-gain.html" title="...
1
vote
1answer
48 views

How to extract all strings in require('')?

My source files are something like this: abl require('../img/a.png') require('../img/b.png') bla require('../../img/c.png') ble <Image source={require('../img/d.png')} My expected output is: '../...
11
votes
1answer
1k views

Replacing [0-9] with [A-J] not working with sed

I am working on a command that replaces all digits 0-9 with their corresponding letters in sed. I know I'm doing something wrong, but sed is not interpreting the replacement regex as anything but a ...
0
votes
1answer
42 views

AutoHotKey script replace backslashes with forward slashes

I run a Linux emulator (or subsystem) under Windows 10, and sometimes I need to past Windows paths in the Linux console. Windows paths use backslashes \ to separate directories whereas Linux paths use ...
13
votes
4answers
1k views

How to recursively replace characters with sed?

Is it possible to replace occurrences of a character sequence recursively without iterating over the same sequence again? By performing a sed as in the following scenarios I can get the mentioned ...
0
votes
1answer
39 views

Regular expression

I need to write a mod_rewrite rule that would match the following string: /modules/users/users/ae/ghwjzL9D2qpnPqv3FRY3JTZ48N the only constant part of the string is /ae/. I need a regular ...
0
votes
0answers
27 views

How to use use find -iregex OR (|) operator?

Uninstalled an application, but it continues to pop up whenever I try to interact with file types that it used to be associated with. As usual, find has been invaluable in finding and eliminating ...
0
votes
0answers
30 views

Ansible Regexp groups, patterns or something else?

I have to use ansible to manage a few DNS zones. We use a playbook and some templates without any issue. However, the serial number of the zone(s) is manually modified by the end users and a lot of ...
10
votes
2answers
2k views

Add character to every number via Regex in Notepad++

I have a very basic question which i just can not get my head around. I do have a text document like this: This is 5 a test! This 3 is a test! This is a 9 test! and i want it to look like this: ...
2
votes
2answers
55 views

Sed Script to Capitalize “I”s in a Text File

I am trying to create a sed command that capitalizes the pronoun I in a text file. For example "i like dogs." should be "I like dogs." So far I have: sed 's/ i / I /g' This doesn't work in a ...
0
votes
2answers
171 views

Nginx server name regex allow dash

I have a site, running on nginx, when comes to the server name i come across some problem regarding the regex, as i know nginx is using Perl Compatible Regular Expressions(PCRE). Now my server name: ...
0
votes
0answers
33 views

Notepad++ Replacement String with NUL Truncates After NUL

Using Notepad++, I'm trying to replace a string (in a binary file) like this: ANULpNULpNULlNULeNUL With another string like this: ONULrNULaNULnNULgNULeNUL So... Using the following format of ...
0
votes
1answer
17 views

Notepad ++ Regular Expressions for Find and delete a line

i have a subtitle just like below 5 00:00:14,030 --> 00:00:15,840 Anya's killing it, don't you think? 6 00:00:15,850 --> 00:00:17,230 She's dedicated. 7 00:00:17,270 --> 00:00:19,890 She ...
2
votes
2answers
98 views

How to delete all text except for what's inside quotation marks?

I want to remove all text except for what's between quotation marks. How would I go about doing that? Example: Bran could hear the wind in the trees, the clatter of their hooves on the ironwood ...
0
votes
1answer
182 views

Matching second last word in sentence through regular expression?

I'm looking for a way to match the second last word on a line, such as this: 123 Smith St Melbourne VIC 3000 I'd like to match just "VIC". Does someone have a regex I can use?
0
votes
1answer
39 views

Notepad++ regex command for searching two following lines

I want to search a file for a word in a line and another word in the line after that For example i want to find a line which contains 75 37 and i want the line after that to contain 8B 45 FC Is there ...
0
votes
1answer
103 views

PowerShell: Search entire file for any string between specific strings and output to another file

I can't seem to find an exact answer for my particular use in one location, so I am asking. I am very new to PowerShell, so the commands are foreign to me. Using PowerShell, how can I search a file ...
0
votes
1answer
56 views

Bulk move via CMD Regex

I have about 15k files in a flat folder. All are named something like blah blah - whatever.png. Basically, I'd like to move them all into folders named blah blah. I don't want to rename any of them, ...
0
votes
2answers
43 views

Regex to Validate a String

I have a string and validate with regex. My requirement to validate the string is Total length is 9 characters First letter should be Alphabetic [A-Za-z] Second letter should be AlphaNumeric (either ...
1
vote
1answer
57 views

NotePad++ Replacing Text Between 2 Consecutive Words

Scenario: I'm trying to come up with a regular expression in a file that contains similar chunks, it's basically PGN Files. Every Chunk Starts With [Event " ..and ents at (1/2-1/2|1-0|0-1) the ...
-2
votes
1answer
34 views

Regex to match Bro IDS logs

How to write a single regex to get subject CN,O,ST,C in the strings if exist. Sample input: {"ts":1537159826.804384,"uid":"CGvaSh4uPO39lxSdU2","id.orig_h":"192.168.8.32","id.orig_p":1287,"id.resp_h":...
0
votes
1answer
29 views

Regex: Find duplicate tags (with or without the same content)

I have 1000 html pages, and I want to find all the pages that has a duplicate tags ("og:title"), such as: <meta property="og:title" content="BLAH BLAH" /> etc... etc... <meta property="og:...
2
votes
1answer
41 views

Take a file of regexes and return the first match for each in another file

I have two files. a.txt has a list of regexes, separated by newlines. b.txt has lines, some of which match the regexes in a.txt. What I want: A command (grep, probably) that will take the two files, ...
0
votes
0answers
23 views

How to write a RegEx for searching Dropbox with grepWin

Hoping you can help a RegEx newb out. I want to use grepWin to search my dropbox for potential issues in filenames that might be causing the sync issue I am having. There might be a more appropriate ...
2
votes
1answer
100 views

Refactoring Code in Sublime Text 3

Currently I do this with Find All (Cntrl+F old_var, alt+enter new_var), but this replaces words in my comments and strings. A comment in this answer suggested the PyRefactor plugin which requires ...
0
votes
2answers
70 views

Removing multiple lines in Notepad++

So I've got a list of dns-name and i'd like to filter out all the ones that are generic using preferrably Notepad++. So for example Name: test-14.45.name.other.com Address: 192.168.14.45 Name: ...
1
vote
3answers
136 views

How can I count how much wood a woodchuck chucks using Microsoft Excel?

TL;DR Is there anything like grep in Excel that can help me count whole-word-only instances (e.g. "wood" but not "woodchuck") (and maybe their variations)? So there's this poem, by mother goose: ...
3
votes
1answer
42 views

How to get a specific string value from an Apple System profiler SPHardwareDataType

I'm using Bash to rename computers en masse using a part of the serial number, which is pretty easy, but my client has requested that the manufacture year of each machine be appended to the end. ...
2
votes
1answer
72 views

Grep on macOS: find unique occurrences of a capturing group in regular expression

I am on macOS and would like to get into using grep (or a similar tool) to find unique occurrences of a certain pattern in a codebase. For example, for finding all console.somemethod() calls in ...