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
1
vote
1
answer
452
views
Adding syntax highlighting for a comment section in Emacs
I have the following
(defun add-c-syntax-highlighting ()
(font-lock-add-keywords nil '(
("\\<\\(\\-+\\)" 1 font-lock-warning-face prepend)
("\\<\\(FIXME\\):" 1 font-lock-warning-...
1
vote
3
answers
693
views
How To Search & Replace From a Word to another in The Same Line?
Like I said,, I want to search each line, from a word at the beginning of the line, To another word at the end !
For Example, let's say that I've a text file, that contains these lines :-
1.RA.xm: ...
1
vote
1
answer
85
views
Matching only numbers that come in numerical order
I have numbers in [.] indicating the page number of an orginal printed document I am transcribing. However, the document also contains other numbers in [.] that do not correspond to page numbers.
For ...
1
vote
1
answer
392
views
Notepad++ replace every 3rd and 4th iteration
I'm using notepad++ I'm wondering if it's possible to replace every 3rd and 4th iteration in lines of HTML.
The original code looks like:
<div class="ui-bar ui-bar-d"
<div class="ui-bar ui-bar-...
1
vote
1
answer
2k
views
subtract a fixed amount from a number in an xml with find/replace in notepad++
It seems like I can't understand much of the notepad++ wiki, and I can't find similar question here.
The problem:
type="0" x="184" y="698" w="245" h="7"
So I'm trying to add or subtract an amount ...
1
vote
1
answer
1k
views
Find & Replace in notepad++ with regex
I need to convert some old VB.net code to c#, and to speed things up I was planning to use regex.
For instance, in this piece of code:
if (Request.ServerVariables("SERVER_NAME").StartsWith("user"))
...
1
vote
1
answer
7k
views
How to find and replace in the between tags in notepad++
I have a problem about find and replace in notepad++.
I want to find a space+space in text and replace with just one space. But the area I want to find and replace is between tags (ex: <div>...&...
1
vote
1
answer
47
views
CLI Perform Regex in Memory then feed to Command
I would like to use a regular expression to modify a file and then feed it to pandoc in the cli.
Something like this:
perl -pe 's/_(.*)_/\\underline{$1}/g' source.md > pandoc -o source.pdf
So, I'...
1
vote
2
answers
692
views
Including " in a regular expression using sed on windows
I have:
echo finally came. 34^"This is the account of | sed "s:[1-9][0-9]["]:<a name=\"top\">&</a>:g"
and I need to get
finally came. <a name="top">34"</a>This is the ...
1
vote
1
answer
134
views
Gedit gktsourceview3.0 rules - multiple optional suffixes
I'm trying to write a syntax highlighter rule for arm assembly to use in gedit. In arm, every command has some optional suffixes which make it execute conditionally. So obviously I want the command ...
1
vote
1
answer
11k
views
Add, replace or delete something/everything between two strings with regexxer
I'm using regexxer to translate an application that use .php files. In accordance to the webpage it's based on usage and syntax of Perl regular expressions. It looks more to be applied to Perl code. I'...
1
vote
1
answer
112
views
How to do concise two alternative substitutions in Windows Excel 2010? [duplicate]
Possible Duplicate:
Can you do Regular Expressions in Excel without VBScript?
I wish to replace a string pattern with another along the lines of the following:
=SUBSTITUTE(SUBSTITUTE(name," ...
1
vote
2
answers
4k
views
Regular expression to replace in TextPad
I need to replace this:
HSOD,BASE,DFLT,001,06-19-2012,[any string],1,0,0
With this:
HSOD,BASE,DFLT,001,06-19-2012,[any string],1,0,N
where the [any string] part needs to be a wild card.
1
vote
2
answers
5k
views
rm command and regular expressions via Linux BASH shell
I am attempting to use regular expressions to remove set of files however the bash shell returns the message
rm: cannot remove `[0-99]+ -': No such file or directory
rm: cannot remove `[a-zA-Z': No ...
1
vote
1
answer
1k
views
Excluding preceding characters from a "Find"
I'm attempting to automatically format portions of a significantly sized document. For one, I'm attempting to apply Heading 1 to all headings in the format of:
1.1 Heading 1
and Heading 2 to:
...
1
vote
1
answer
5k
views
Specific case of non-greedy `grep`
I know there are many examples of a non-greedy regex with grep, but I'm having problems with my specific case.
My file contains lines similar to:
[X12345.Yabc.Z7989].[ALPHA/BRAVO].[CHARLIE.DELTA]
...
1
vote
1
answer
56
views
Jump to the next line that has a statement after an if()
A previous dev liked to put single statements on the same lines as their relevant if()s. I'm trying to find these lines now to fix them! I thought that the following regex would find them, but it isn'...
1
vote
1
answer
2k
views
Moving parts of a string with a Regex in sed
I am trying to replace,
input.output.roomMAX[0] to input.output.room[0].MAX
input.output.roomMAX[1] to input.output.room[1].MAX
input.output.roomMIN[variable] to input.output.room[...
1
vote
1
answer
3k
views
Using RegEX To Prefix And Append In Notepad++
I found this question on StackOverflow. It worked great but I also need to include lines that have non-alphabet characters in it like:
some_name
some.name
And add prefixes like this:
start:"...
1
vote
1
answer
38
views
Looking for a command that will return the proc, func, etc that uses another proc, func, etc
Grep-ing for a function name to see where it's being used returns a list of rows and row numbers. Is there a smart way of using grep and awk to get the name of the calling procedure instead?
Thanks
1
vote
1
answer
5k
views
How to search emails by matching header fields against regex "in" Thunderbird?
How to search emails by header fields such as Subject, Sender, Receipt, against regex? The emails are fetched and read with Thunderbird. But the searching doesn't need to occur through Thunderbird ...
1
vote
1
answer
474
views
regex to put an actual newline at every \n
I'm writing a bash script that will deal with blob data that needs to be written to a file. The data inserted into the blob is separated by newlines. The command line mysql -e select blobfield from ...
1
vote
2
answers
1k
views
Finding files in linux based on regex, with multiple alternatives
Let's say I have a list of strings. I want to find files with filenames starting with these string.
Example,
Strings:
filename.could.start.with.this.restoffilename
a.file.could.have.this.at....
1
vote
1
answer
81
views
How to show regexp
I want to show what stands behind a regexp, for example, I want to print all chars covered by [A-z] in the bash.
1
vote
2
answers
501
views
cut text from each line in a txt file
i have a text file where each line looks like this:
<img border=0 width=555 height=555 src=http://websitelinkimagelinkhere>
each line is like that for like 1500 lines, i want to sort of '...
1
vote
2
answers
411
views
How to show regexp parts of text
I've lots of files which lines looks like
lotsofblah/XY##_####_morefoo
where # is a number. Now i want to show only the parts
YZ##_####
in the bash, each in a new line of course.
1
vote
1
answer
2k
views
How to replace a word with Regular Expression in Microsoft Word 2007?
How can I replace a word with Regular Expression in Microsoft Word 2007?
For example, I want to find and replace all \n with some spaces.
1
vote
2
answers
674
views
crawler for retrieving regular data - firefox
I need crawler-extension for firefox who could search for all phrases in source code or just in text which are suitable to given regular expression.
Do you know something like that?
1
vote
1
answer
7k
views
Hot to remove special chars from filenames and rename them in a directory?
This is what I have so far.
#!/bin/bash
pushd DirectoryName
for file in *.csv; do
#echo $file
filename=${file%.*}
file_clean=${filename//[ ()$+&\.\-\'\,]/_}
final= "$file_clean....
1
vote
1
answer
353
views
Is it possible to submit regex to google web searches?
Is it at all possible to submit any form of a regex to google web search? Even a wildcard character would be interesting tool. Or is it literal strings and options only?
1
vote
1
answer
92
views
regex for searching a word in a word
i have a csv file which i need to filter mails marked with the word 'spam'
lines look like this
email;text;somestatus;mailserver status response; response message
[email protected];mx.mail.com;2;...
1
vote
1
answer
22
views
RegEx replacement in NotePad++
I need to replace many different lines in a html file where lines look like this:
<span lang="en-ca">random string</span>
with just
random string
For example
my<span lang=&...
1
vote
1
answer
189
views
Decline all URIs with tilde character in Nginx
I would like to return a 403 whenever a request contains a tilde character (~)
Example: https://example.com/~/item-1/ or even. https://example.com/item1?status=~pending
I want the above to return a ...
1
vote
1
answer
384
views
Combine two regex formulas into one (using notepad++)
Si cum îi semănau ! Fraţi buni, puindu-si, ca si el, tot sufletul
în ceea ce făceau, muncind din greu, luptind din greu, jert-
findu-se, fără nici un gînd de răsplată.
Simțind în tot ceasul,
...
1
vote
1
answer
105
views
Notepad++ regex make text url safe and compliant
How to create regex which would to the following:
I have long list of product names and SKU's separated by TAB.
Name Nameson[TAB]SKU
Name2 Nameson 2[TAB]SKU2
I would need the text to go:
FROM
Joey's &...
1
vote
3
answers
683
views
How to extract specific text from notepad ++
I have a log file that I need to extract specific data elements from.
Example text:
[22-12-20 21:16:04.521] FROM LIVE <$011B4B50:FleetCard_10:1,51.75,1,1,200001,Fleet No,5411,34319,TARJETA,,51....
1
vote
3
answers
115
views
How do I use regex for text on two separate lines at once?
Im fairly new to Regular Expression but I cant seem to get this right (even though it works on regex tester websites) it doesnt work on Notepad++.
Example RegEx (yes the " " is a part of ...
1
vote
1
answer
324
views
Extract variable names from .txt file with RegEx
I want to extract a variable name (e.g. $00incomplete_frame) from a text file and place the names in a variable for use in PowerShell.
The source variable names do not contain spaces. A source file ...
1
vote
1
answer
47
views
How to apply to multiple filenames in Windows command line?
I'm using tar in Windows 10 command line to extract a specific file from a bunch of archives.
I'm quite experienced in regex, but I have very little experience in Windows commands.
I'm using this ...
1
vote
1
answer
279
views
Select two 1 hour (HH:MM) string values with regular expressions
I have the string or text data:
[string]$hours = @"
10/10/2022
08:11
14:34
06:23 00:00
11/10/2022
08:05
14:28
06:23 00:00
12/10/2022
-
-
00:00 00:00 Día Festivo
13/10/2022
...
1
vote
3
answers
8k
views
how to remove all zero width space from the text?
I know how to use regular expressions to do the mass search and replace task in editing program
But I don't have or can't find the entire list of zero width space unicode. I quick searched the google ...
1
vote
1
answer
1k
views
Regex: delete all html tags from html tags, except some other html tags
I need to delete all html tags, such as <p style="text-align: center;"> , but except </em> and </em> from the html tag <p class="glovo"></p>
EXAMPLE:
...
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 ...
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 ...
1
vote
1
answer
660
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&...
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 ...
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-
...
1
vote
1
answer
256
views
Remove the first blank line from every document Notepad++
I use markdown with YAML frontmatter as below. I want to remove the first blank line that appears in every document using Notepad++. I would appreciate if anyone could help me to do this. Thanks in ...
1
vote
2
answers
605
views
Regex: Select/Find all html tags that contain only 4 words
I have this 2 html tags. I want to find all html tags that contain only 4 words (only the first line in my example)
<p class="mb-40px">My name is prince</p>
<p class="mb-...