Dreamweaver regex finding and replacing text? - regex

I want to ask how the format regex to change each word like this ?
ex:
AAAAAA*BBBBB
Bad*Good
Black*White
ss+bb*cc+gg
result:
(AAAAAA*BBBBB)
(Bad*Good)
(Black*White)
ss+(bb*cc)+gg
thanks, sorry for my english

/([a-zA-Z]*\*[a-zA-Z]*)/g
and replace with:
($1)
DEMO: https://regex101.com/r/fP6gN4/2

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

Regex - how to get time and date and get ISO8601 timestamp

I have this text
2014-01-30 10:15 some text here
2014-01-30 10:20 some other text here
I need a regex that matches a timestamp group in ISO 8601 format.
Required output:
2014-01-30T10:15Z
2014-01-30T10:20Z
With this REGEX I can't get what I want, replace the space with 'T' and append a 'Z at the end.
^(?<timestamp>\S+ \S+)
Does anyone know how to solve this problem?
--- UPDATE ---
BTW, I'm using http://rubular.com/ to test my regex
You could perhaps modify your current regex a bit to:
^(\S+) (\S+).*
And replace with $1T$2Z
regex101 demo
\d{4}-\d{2}-\d{2} \d{2}:\d{2} will match the required format – validation is another story though (if you need it).
You can do something like if (regex match) { replace " " with "T"; append "Z" }
If this doesn't help you or it is unclear it is because your question was vague.
Edit: you didn't specify what language you're writing this in. That is how you would do your replacements.
In php:
preg_replace('/^(\S+) (\S+).*/', "$1T$2Z", $str);
In perl:
$str =~ s/^(\S+) (\S+).*/$1T$2Z/;
In notepad++
Find what: ^(\S+) (\S+).*
Replace with: $1T$2Z
With:
(\d{4}-\d{2}-\d{2})( \d{2}:\d{2} )(?:.*)
You can capture 2014-01-30 10:15 in groups (and ignore the text in another group).
Then you use the second group (10:15) to add 'T' at the beginning and 'Z' at the end.
See demo at:
http://rubular.com/r/4icGfcIixa
Regex is a bit different from language to language, it could help if you told us what language you are using.
For example, in javascript, you can do something like this:
"2014-01-30 10:15 some text here".replace(/(\d{4}-\d{2}-\d{2})\s(\d{2}:\d{2})\s?.*/,"$1T$2Z")
Where the string can be a variable.
If you have a multiple line text them you should add a g at the end of the regex:
"2014-01-30 10:15 some text here\n2014-01-30 10:20 some other text here".replace(/.*(\d{4}-\d{2}-\d{2})\s(\d{2}:\d{2})\s?.*/g,"$1T$2Z")

RegEx with notepad++

100.
101.
102.
guys this is my text and i want to change like this:
<tag>100.</tag>
<tag>101.</tag>
<tag>102.</tag>
My RegEx is:
[0-9][0-9][0-9]\.
Replace with:
<tag>\1</tag>
But it does not work :(
I could not see the numbers and dot sign.
Thanks in advance
You need some (capturing) parentheses;
Re: (\d{3}\.)
Replace <tag>\1</tag>
You're missing the \. in your brackets. Try this $regex = ":[\d\.]+:".

find and replace regex for reformatting the value

I have a text like :value_subvalue that I want to transform to :value[:subvalue].
I have a find & replace field in Coda where I can enter a regex to find and replace.
Any idea how to do this?
You haven't said what language, so this is a generic answer:
Search regex: (:[a-z]+)_([a-z]+)
Replacement: \1[:\2]
If you're doing this in java, the group refs would be $1 and $2