i have this txt
02/02
z/2019
i want it to look like this
02/02/2019
how can i achieve this using notepad++ regular expression function
This is possible with the "Extended" syntax only, you don't even need regular expressions.
Find: \r\nz
Replace:
Related
I need the regular expression pattern which should not allow to put any of following characters into input in HTML
,;:|
You may get some idea from this.
[^,;:|]+
DEMO::: https://rubular.com/r/dKQzC1HrnMG88X
I want to replace the text
Tag="...",
with
<Header="...", Style=Something>
while reserving the ... part. Can I do it with regular expression or some features of Sublime Text? Thanks!
Yes if you prefer. Use Ctrl + H to open the Search and Replace, enable Regular Expression..
Find What: Tag="([^"]+)",
Replace With: <Header="\1", Style=Something>
For content like this:
Tag="this is a \"simple\" test",
pattern: Tag="((?>\\.|[^"])*)",
Replace: <Header="\1", Style=Something>
I have to make changes to URL's in a couple of notepad files. I was hoping if this could be done using regular expressions.
The URL's are in the following structure,
/web/20120730114452im_/hxxp://mysite1.com
/web/20120730114453im_/hxxp://mysite2.com
/web/20120730114454im_/hxxp://mysite3.com
/web/20120730114454im_/hxxp://mysite4.com
I have to remove the part before the hxxp so what remains after the search and replace is,
hxxp://mysite1.com
hxxp://mysite2.com
hxxp://mysite3.com
hxxp://mysite4.com
What is the regular expression I need to use to get the desired result ?
Thanks for your help.
Okay, as per your confirmation, a proper regex that won't match too much would be this:
/web/[0-9]+im_/
Where [0-9]+ will match any amount of numbers.
regex101 demo.
Don't forget to check the 'regular expression' checkbox in the Find/Replace dialog box.
USE THIS,
FIND: [ a-z 0-9 _ / ]+/hxxp
REPLACE: hxxp
I want to format html document and it has full of inline css. I use notpad++ and try regular expression to format it.
I want to replace style='font-family:"Arial","sans-serif"....... etc ' with style=''
How to do this with regular expressions?
I am new to regular expressions.
Replace :
style='[^']+'
with:
style=''
[^']+ matches one or more characters that is not quote(')
I've got strings like:
('Michael Herold','Michael Herold'),
but I need to remove the last parts so I end up with:
('Michael Herold'),
I'm still new to Regular Expressions so they confuse me. I'm using Notepad++.
find: \('([^']*)','\1'\)
Replace: ('\1')
So the actual function you use will depend on the language. Notepad++ is a text editor, not a language.
The regular expression that you will want will be ",'Michael Herold'" and you'll replace any matches with "", the empty string.
So in PHP for example, you'll have
$source = "('Michael Herold','Michael Herold')";
$pattern = "/(,'Michael Herold')+/";
$newString = $preg_replace($pattern, $source, "");
Do the equivalent in whatever language you use.
I'm not sure what flavor of regular expressions Notepad++ uses, but try replacing this expression:
\('([^']*)','\1'\)
with this one:
('$1')
The \1 matches whatever was found in the first set of single quotes (Michael Herold in your example), and $1 is replaced with that same string. (Try \1 if $1 doesn't work in Notepad++.)
See it in action here.