How to match strings using Regex - regex

I have this:
https://lh5.ggpht.com/-05ne7Y9Dlog/Xyiy88vo_gI/AAAAAAAAHV4/EwmlTE7FiDonC_lh6Z-UrAtZz_39zRo3QCLcBGAsYHQ/w400-h270/1.png
https://lh5.ggpht.com/-x5hXwqku5es/XyjF5x9Q_jI/AAAAAAAAHWw/F4ayROJynrwKd1H699eu4Ji0yEfayS_RwCLcBGAsYHQ/w171-h200/3.png
https://lh5.ggpht.com/-lWHlL8F0FJo/XyiuolbZWwI/AAAAAAAAHVA/-fOvqyq2rTUxZI2Vxg0op5NwZjg-Apz9QCLcBGAsYHQ/w856-h1000/3.png
And i want to match strings like "w400-h270", "w171-h200", "w856-h1000"... Anyone can help me to solve this. Thanks.

(w\d+-h\d+)
Then extract the contents by group(1)

Related

Remove spaces in string under quotation in Notepad++ using RegEx

Suppose I have these strings:
'akshay ' ,
' ankur'
I want to remove trailing and leading spaces present under quotation mark like this:
'akshay',
'ankur'
How can I achieve this in Notepad++ using RegEX?
Use this to find: '(\s*)(.*?)(\s*)' and this to replace: '\2'.
Find this regexp: (^')\s+(\w+)\s*(')|(^')\s*(\w+)\s+(')
Replace with : \1\2\3\4\5\6
Like this:
All the RegExp given above solve my problem in a better way. I appreciate to all who helped me to solve this problem. Thank you everyone.
Here i am going to add a RegExp given below which can be used to count total number of spaces inside single quotation. It can be used to remove all spaces also.
Find--> \s(?!(?:[^']*'[^']*')*[^']*$) and ReplaceWith-->Nothing to do(leave blank) then click 'ReplaceAll'.

Dreamweaver regex finding and replacing text?

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

Regex replace keeping part of a string and adding data

I have this file with thousands of records (more thank 300.000) and I have to replace all the occurrences of a particular string but keeping some of it.
I'll give you an example, the string would be
\123
\34565
\923
..etc
so basically I would have to convert these strings in to
'|''|'123'
'|''|'34565'
'|''|'923'
does anyone have a quick solution for this?
Many thanks
Try this -
Regex - \\(\d+)
Replace with - '|''|'\1'
Demo here
Use this regex:
\\(\d+)
You should use g(global) modifier to match all. So your final regex would become:
/\\(\d+)/g
and replace it with:
'|''|'$1'
Demo:http://regex101.com/r/yO3xQ6

Jmeter - Regex Extractor not working

I'm trying to extract a simple string from the HTML response.
The response looks like this
patients-list-of-visits.aspx?p=a1363839-76fb-43f3-97ba-26218faefee1
The Regex I have tried so far are
patients-list-of-visits.aspx?p=(.+?)
patients-list-of-visits.aspx?p=(.+)
Can someone please let me know what am I doing wrong here?
Thanks!
This is better:
patients-list-of-visits\.aspx\?p=(.+)
2 remarks
don't forget to escape . and ? if you want to match them literally
your first attempt .*? is a lazy match and will result in in only the first letter being matched. Your second attempt is better

First occurrence of a character in string. Regular expression needed

I have some CSV data like this:
1325318514,197.1,184.9,172.4,146.0,147.3,131.1,280.9,182.7,12.6,5.0,0.0,73001,65848,0
1325318536,196.2,184.2,172.1,146.3,147.1,131.1,264.9,175.6,12.6,5.0,0.0,71590,64616,0
1325318557,196.6,184.9,172.1,147.6,146.8,130.9,264.9,178.4,12.6,5.0,0.0,69607,61274,0
1325318578,196.7,184.2,172.1,148.4,146.8,130.6,255.9,174.0,12.5,5.0,0.0,74127,59221,0
....
i want to replace the first , with a space on each string but not the rest of the ,s
Any ideas on the regexp for that? Tried a few different things and just cant seem to get it to work...
your question is not very clear, I just give an example, hope it is helpful for you:
sed 's/,/ /1' <<<"1325318514,197.1,184.9,172.4,146.0,147.3,131.1,280.9,182.7,12.6,5.0,0.0,73001,65848,0
1325318536,196.2,184.2,172.1,146.3,147.1,131.1,264.9,175.6,12.6,5.0,0.0,71590,64616,0
1325318557,196.6,184.9,172.1,147.6,146.8,130.9,264.9,178.4,12.6,5.0,0.0,69607,61274,0
1325318578,196.7,184.2,172.1,148.4,146.8,130.6,255.9,174.0,12.5,5.0,0.0,74127,59221,0"
output:
1325318514 197.1,184.9,172.4,146.0,147.3,131.1,280.9,182.7,12.6,5.0,0.0,73001,65848,0
1325318536 196.2,184.2,172.1,146.3,147.1,131.1,264.9,175.6,12.6,5.0,0.0,71590,64616,0
1325318557 196.6,184.9,172.1,147.6,146.8,130.9,264.9,178.4,12.6,5.0,0.0,69607,61274,0
1325318578 196.7,184.2,172.1,148.4,146.8,130.6,255.9,174.0,12.5,5.0,0.0,74127,59221,0
In most regex implementations, use the pattern
/([^,]*),(.*)/gm
And replacement text
$1 $2
See it online at http://refiddle.com/1ot