Regular Expression Notepad++ to Find & replace strings - regex

I have strings like following in a line
Q80a_Offline_MElDor_NET
Q80a_Offline_Mr_NET
Q80a_Offline_Mor_NET
I want to remove _NET from them using regex in Notepad++.
I also have following in the same line in the file which I don't want to touch.
Q80a_MElDor_NET
Q80a_Mr_NET
Q80a_Mor_NET
I can find these strings with following search string.
^Q80a_offline_[a-zA-Z]+_NET$
but not sure what to use as replace with regex expression
I want Q80a_Offline_MElDor_NET to be Q80a_Offline_MElDor
please help.

_NET$
Try this.Replace by empty string.See demo.
http://regex101.com/r/yR3mM3/55
or
^(Q80a_offline_[a-zA-Z]+)_NET$
Replace by $1.

Related

In Notepad ++: Replacing some string with something else in all the lines containing another string

In the example below, is there any way to place a string like ("1one1") before {",} at the end of all lines which contain {ī}?
īn:"ZZin",
ín:"FFin",
ǐn:"QQin",
ìn:"TTin",
ie:"XXie",
iē:"TTie",
ié:"GGie",
Thanks
Using Notepad++ regex search for ^(.*ī.*)(",)$ and replace with \11one1\2.
You will need to use regex regex for notepad++.
so, mark "Regular Expression" in the final of Replace box.
in your fields to search:
find what: ī.[^"]"([A-Za-z0-9]*)
replace with: īn:"\11one1
i think it will do what you want. Let me know if it doesn't to edit the regex.

Notepad++ Remove text before characters but have 2 same characters on every line

Hi masters i need your help on Notepad++ RregExpp
i have text like this :
01:example#mail.com:test
need to convert like this :
example#mail.com:test
Thank you in advance if you help me.
Use expression ^... and replace it with empty string or better with \n like following (and remove the first two characters):
Here is a way to go:
Ctrl+H
Find what: ^[^:]+:(.+)
Replace with: $1
Replace all
Make sure to have checked Regular expresion but NOT . matches newline

How to select text between greater than and less than with an additional slash

I'm trying to select text between ></ . Example below I want "text"
>text</
but I'm unable to do so.
tried the following but it doesn't like the slash at the end of the regex
\>(.*?)\<\
I'm trying to do this in TextPad. How is this supposed to be done?
I'm ultimately wanting to delete all text between these two characters so all I'm left with is something like: <element></element>
RegEx wise, you can use 3 groupings and for the replace only use the first and 3rd group: \1\3.
Find: (>)(.*)(</)
Replace: \1\3
Try doing:
\>(.*?)\<\/
The regex that you were trying would actually have given error because you had a \ and nothing after that.
You are close.. use the following:
(>).*?(<\/)
And replace with \1\2
See DEMO
OR
You can use lookbehind and lookaheads:
(?<=>)(.*?)(?=<\/)
And replace with '' (empty string)
See DEMO

Replace string with the same start and end in notepad++

Not much of a expert in regular expression here. My IT colleague dump my a text file which containt all our mailing list. But I need to clean it before using it.
I need to find and delete a string of text which always start by "3EA" and finish by "////".
I try several ways, but no cigars.
Here's some example of the string I need to delete :
3AEAEACjkCjm////
3AEAEACjlCjn////
3AEAEACjnCjp////
Thanks
3AE[a-zA-Z]{9}/{4}
Try this.See demo.
https://regex101.com/r/vN3sH3/61
You could use the below regex,
3EA\S*?////
Add anchors if necessary.
^3EA\S*?////$
Assuming there are always 9 alphabetical characters in between 3AE and ////, in search and replace (in regex mode) replace this pattern with a blank pattern:
3AE[A-Za-z]{9}////

How to add slightly similar content with regular expressions (regex)?

I'm using Dreamweaver on a file that has about 30 instances the following:
'portfolio_bg' =>'#555555',
'portfolio_font'=>'#ffffff',
But, for each instance the hex codes are different. I want to add the following two lines underneath the above:
'product_bg' =>'#555555',
'product_font'=>'#ffffff',
where the hex codes in my two product lines will match the hex codes of the portfolio lines above it.
How do I accomplish his using regular expressions in Dreamweaver's Find and Replace?
Thanks in advance.
This works for me in EditPad Pro; it should work in Dreamweaver too.
Find:
'portfolio_bg'\s*=>\s*'(#[0-9A-Fa-f]+)',(\s+)'portfolio_font'\s*=>\s*'(#[0-9A-Fa-f]+)',\s*
Replace:
$&$2'product_bg' =>'$1',$2'product_font'=>'$3',$2
EDIT: corrected replacement string to use $& instead of $0.
For the first line, use the following RegEx replacement:
Find:
'portfolio_bg'[ \t]*=>[ \t]*'(#[0-9]{6})',
Replace:
'portfolio_bg' =>'\1',\n'product_bg' =>'\1',
For the second line,, use the following RegEx replacement:
Find:
'portfolio_font'[ \t]*=>[ \t]*'(#[0-9a-f]{6})',
Replace:
'portfolio_font' =>'\1',\n'product_font' =>'\1',