Questions tagged [regex]
Also known as regular expression or regexp, a description of a set of strings, often used for searching and validating strings.
2,091
questions
0
votes
2
answers
274
views
How to fold text files?
I am currently editing down multiple large text files (maybe 500 text list files) , and need to fold this files
For example this is one of my text files:
1966 Q3
Fort
COB
LGL
Asse
AP
BAS
Lis
46.81
11....
0
votes
1
answer
658
views
How can I delete everything before and after text that selected by regex? [Notepad++]
I am currently editing down multiple large text files , and need to delete everything before and after text that selected by this Regex ^NewPage.+?NewPage$
For example i have this text:
V.prototype.Jb=...
1
vote
2
answers
991
views
Regex remove part of a file name
OS: Windows 10
Tool: PowerRename
I need to remove the # symbol and the number in a file name IE:
ABC 2020 Sec. Fund - 2021 - # 1 Doe, John.pdf
to
Doe, John - ABC 2020 Sec. Fund - 2021.pdf
Using this ...
0
votes
1
answer
299
views
Replace Host URL including square brackets
In Ubuntu 18.04 I am trying to replace a line hosts: ["localhost:9200"] with hosts:"http:xx.xx.xx:9200" by using the below command but it's not getting updated in the target file.
...
0
votes
1
answer
721
views
regex to capture any http:// or http// links in JSON - Java 8 format
I have some URLs like this
https://mega.nz/sometest
http://depositfiles.com/files/sometest
https://www.mediafire.com/file/aaaaaaaa/bbrtbrbrb_%iiiiiiii_.zip/file
I usually use
(https?://mega\.nz[^>]...
0
votes
1
answer
820
views
Regex to extract specific text from nested html tags
I have this text
<div id="navbar"><a href="../index.php">Final Fantasy Shrine Forums</a> > <a href="./f-90.html">Downloads</a> &...
1
vote
1
answer
135
views
Replace two strings at the same time with one in Notepad++ using regular expressions
How to replace two strings at once with one in Notepad++ using regular expressions?
I need this:
================
================
Replace with this:
--------------
1
vote
2
answers
137
views
Reverse Quotes in a document using Regex
I have a document which contains lots of sentences in quotes. Issue is that some of them are properly quoted and some of them have reverse quotes, meaning the opening quotes are at the end of the ...
0
votes
1
answer
815
views
Regex: Find al words between <em> and </em> html tags, that have no space before `<em>` and after `</em>`
See this sentence below:
A space of creation conceived as a <em>full</em>attributed to myself.
You see that is no space before and after </em>
So, I need to find al words between ...
0
votes
2
answers
3k
views
Replace date format in Notepad++ using regular expressions
I have dates as MonthYear, Month-Year (ex: May16, Jul-21) but I need them to be in dd.mm.yyyy format.
For example:
Aug20, needs to become 01.08.2020
May-19, needs to become 01.05.2019
Jul18, needs to ...
0
votes
2
answers
685
views
Extract only specific fields from csv file in NotePad++
I'm trying to filter a csv file.
The format is in the following order
1,2017-06-27,"The Greatest View","Flume Feat. Isabella Manfredi",https://www.shazam.com/it/track/99802230/the-...
1
vote
1
answer
1k
views
Extract text using RegEx without VBA
I have the following text, and I'd like to pull the PO number. Sometimes it starts with the words PO, sometimes it doesn't. If it doesn't, then PO number will start with either 901 or 902.
PO or PO ...
0
votes
1
answer
850
views
Sed Regular expression to extract MAC address from file
I would like to know what are changes I need to make to my regular expression to work with 'sed' in Linux (actually, I am working with (GNU sed v4.8) in OpenWRT).
I have a file containing a list of ...
0
votes
1
answer
297
views
Regex for capture lines starting with numbers
In Ubuntu, take the file /etc/passwd as an example. I'm trying to capture the lines 41-46 through a regex. I'm using this command:
nl /etc/passwd | grep 4[1-6]
The output is this:
17 ******41:41*****...
0
votes
0
answers
388
views
Awk regex: how to remove all punctuation except when in the middle of a word?
Following information gathered on this thread, I wanted to use this code to fill my needs, however the code provided wasn't working for more than one punctuation character (e.g. '...'). I thus wanted ...
0
votes
1
answer
165
views
Filtering input (numbers only) from a text with regex
I'm trying to figure out regex and using regexr.com to clean up a long list of GPS addresses.
The file is formatted a bit like this;
</extensions>
</wpt>
<wpt lat="44.9883638" ...
0
votes
1
answer
2k
views
Notepad++ find multiple matches on the same line and only return extracts from those matches
Posting a revision of this question which was initially answered by @mashuptwice (see Notepad++ : How to find multiple instances of a string on the same line and replace the entire line with found ...
8
votes
4
answers
2k
views
Find and replace in Notepad++: How to insert above line with same amount of indents?
I need to replace, in a large number of Python files with many function definitions, all occurrences of
def some_func(foo, bar):
with
@jit(parallel=True)
def some_func(foo, bar):
with whatever level ...
3
votes
2
answers
5k
views
Replace text inside double quotation marks using Notepad++
I'm trying to replace a lot of lines that would otherwise take so much time.
In this case, I need
"Test": "Test1"
to become:
"Test": "Test2"
I tried a lot of ...
0
votes
1
answer
946
views
Notepad++ : How to find multiple instances of a string on the same line and replace the entire line with found strings
For example:
Suzy sells sea shells for USD$55 and USD$65 and USD$20
Dave sells all kinds of junk for USD$30
Philip sells CDs for USD$40 and USD$10
Output needs to be:
55, 65, 20
30
40, 10
The ...
0
votes
1
answer
61
views
How to get links of another workbook using Regex in MS Excel?
I have a bill folder containing all the bills, named as
Bill No. Customer name
, if bill no is
36
and customer name is
Star Enterprise
, Bill is named as
36 Star Enterprise.
I want to access ...
1
vote
1
answer
357
views
htaccess RewriteRule regular expression for url with any nesting
There is a site example.com/aaaa/bbbb/cccc/.../zzzz, where /aaaa/bbbb/cccc/.../zzzz is a path with any nesting.
If the URL contains a file or directory starting with a dot (hidden file or directory) ...
0
votes
0
answers
97
views
Want to remove duplicate key value using regex
I have logs like in this format and wanted a unique key value by using regex.
{
url_path:"/v1/test/user",
transaction_id:"ABCD-EFGH-IJKLM",
},
{
url_path:"/v1/test/user",...
1
vote
1
answer
659
views
Transportrule -> Text Pattern Regex to capture domain and subdomain
I'm running an On-Premise Exchange 2010 with the following Transportrule checking for Text Pattern on Sender Address:
^.+@(?=.*microsoft)(?=.*.com).*$
Above Regex gets captured if "microsoft&...
0
votes
1
answer
286
views
Notepad++ How to copy text, so I can paste into Find/Replace
The first line of my files is a single word (of varying lengths).
I wish to copy that word (and delete it), then paste it at the start of all the other lines in the file.
I can do the pasting part!, ...
1
vote
1
answer
28
views
I need the proper formatting for a regex find for this -aword-
This is my first time writing code, so give me a break. It is a project I conceived of, I am doing for humanity. And could use a little help! It will assemble clips, combine clips into videos, with ...
0
votes
1
answer
3k
views
Find mutiple special character in Notepad++
I have to found in multiple Logfiles entrys in logfiles. The returm musst include the following () ()
so like in line with Weber Tom (PRD) (PRD); but not Huser Andri (PRD)
----Log File----
DEBUG - [...
0
votes
4
answers
767
views
How I can make Greenshot pattern start from 1 to 9999999?
I recently started using Greenshot and it's a fantastic program for screen capture, but I have problem with ${NUM} pattern. It starts like this:
000001,000002,etc.,...
How I can make it start like ...
0
votes
1
answer
1k
views
MS Word how to remove the "-" splitting a word to justify a paragraph?
I want to remove the "-" splitting a word to justify a paragraph.
I tried to use the following replace
But when applying it I get -> instead
example
he want to gener-
ate the idea
...
1
vote
1
answer
44
views
How do I remove duplicates that have a difference of one word?
I have a folder with thousands of zip files, many of which are the same but for different countries. E.g. I would have three files called:
File 1 (USA)
File 1 (World)
File 1 (Europe)
How can I make ...
1
vote
1
answer
831
views
Removing the dash from both ends of a pattern using Regex
I want to remove the dash from both ends of a pattern -L-07-TV-04-Clip-01- using Regex.
-L-07-TV-04-Clip-01-
-I-have-to-realize-
-me-having-this-addiction-
-END-OF-CLIP-
-L-07-TV-04-Clip-02-
...
0
votes
1
answer
1k
views
Regex to delete text before Email Address
This is what I have:
FirstName1 LastName2 [email protected] ID1
FirstName2 LastName2 [email protected] ID2
... and so on.
This is what I need:
[email protected] ID1
[email protected] ID2
... and so on.
As ...
0
votes
1
answer
880
views
A regex expression that select a specific character in a given word
Example a regular expression that sélect the character « P » in all occurence of word « PARIS » in a text.
Having a text like :" I live in PARIS, my friend lives in PRAGUE. My father is coming to ...
0
votes
1
answer
88
views
Using FART, how would you search through files matching only a specific known set of file extensions (e.g., .*php|*.html)
Using FART, how would you search only from a known set of file extensions (e.g., like this REGEX .*\.(php|js|html?|css|txt|htaccess)$) without using the *.* catch-all, to process a find-and-replace-...
0
votes
2
answers
912
views
sed replace every character in match with single character like █████ redaction
Is there a sed replace function (or other Regex) that will replace every character caught by the match pattern with a single character that is meant to overlay or REDACT the matches? For instance the ...
0
votes
2
answers
1k
views
Why Dreamweaver regex replace into a wrong character? (-- How to regex replace content specific to (inside) an html tag?)
Situation
Here is the Regex & Substitution I used for Regex replace in Dreamweaver::
(( and )|( that )|( include )|( includes )|( including ))
$1<br/>\n
image: settings for Regex Replace ...
1
vote
0
answers
778
views
Where is the carriage return character?
I am confused about the carriage return character \r in Windows.
As everybody knows, Windows uses CRLF, i.e. \r\n, to terminate lines. So I thought, and tested it out. I opened Visual Studio Code, ...
0
votes
1
answer
369
views
Regex: Select and replace empty lines/empty spaces between two strings on paragraph
I have this html paragraph. You see that between starting tag and the text there are some empty lines/empty spaces. I must delete them.
<p class="gaga">
Otra característica de este ...
0
votes
0
answers
29
views
notepad++ regex replace without loosing search criteria
"@Deprecated" code should not be used111 Synchronized classes Vector, Hashtable, Stack and StringBuffer should not be used67 Class variable fields should not have public accessibility56 ...
0
votes
2
answers
411
views
Find/Replace character in notepad++ using wildcards
I've done some research on this topic, but I've not been able to quite find the exact solution for my particular need. I'm using Notepad++ to write some Z80 assembly code. I need to replace all ...
-1
votes
2
answers
137
views
regex to find characters in a filename
i have a bunch of filenames (an example is below) and would like to find all files that contain the phrase "_pn".
i 'm trying to remove the "-pn" at the end of the filenames by ...
0
votes
1
answer
168
views
Regex: Add html tags at the lines that doesn't have html tags at the beginning and end of it
I have this paragraph. Also, I have a line I need someone to take me home. that doesn't have html tags. So, I need to find this line (not others) and frame it between tags
<!-- START -->
<p ...
0
votes
1
answer
176
views
Using Notepad++ I need a regular expression to find and replace
Today I learned about regular expressions. Today I also learned that I'm terrible at regular expressions!
I've been toying around with them and have an understanding of some features but what I ...
0
votes
1
answer
338
views
Notepad++ Regex: Replace Text in Line with Capture from the Next Line
I've got some text that looks like this:
if ( != null)
command.Parameters.AddWithValue("@IsDeleted", acct.IsDeleted);
else
command.Parameters.AddWithValue("@IsDeleted", ...
1
vote
2
answers
2k
views
Regex: delete all text except 'SS' followed by 4 to 8 characters
I have a long text file that looks like this:
Species: Sorbus subcuneata | Somerset Whitebeam Date: 2007-09-30
England OSGR: SS7448
Species: Sorbus subcuneata | Somerset Whitebeam Date: 2007-09-...
0
votes
1
answer
3k
views
Match all lines which contain string but do not contain other string (with regular expression)
I have this 3 lines, starting with <p class="sd-23">. The second line does not contain the closing tag </p>
So, I need to use a regex as to find all lines which contain <p ...
-1
votes
1
answer
587
views
How to replace a pattern (return to line not preceded by dot) in MS word
I want to replace all the return to line that is not preceded by a dot in MS word
I can do a replace of ^p by space but I want to replace only ^p preceded by a dot (.)
0
votes
1
answer
955
views
How to find a multiline partial regex match in multiple files?
I have a bunch of files. Every file can contain one or more matches for the following regex pattern:
(foo)([\s\S]+)(bar)
The matches can contain line breaks / multiple lines.
I want to extract all ...
0
votes
1
answer
2k
views
Regex first column header csv
What would the regex be for matching the first column header in a csv file?
id,field1,field2
1,n/a,n/a
2,n/a,n/a
...
I just safely want to match id
0
votes
1
answer
484
views
How to remove lines that not containing any uppercase letters or lowercase letters or numbers notepad++ after ":"
I've never used a regex before.
I'm looking for a regex command that can help me bookmark lines AFTER ":" that has:
at least 1 uppercase letter
at least 1 lowercase letter
at least 1 number ...