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'.
Related
I would like to append _OLD to the end of each strings that starts with SR_ but before the symbol ' or without it
For example my text is the following:
SR_Apple
When the 'SR_APPLE' rotten, we must discard it.
I would like the find and replace to do:
SR_Apple_OLD
When the 'SR_APPLE_OLD' rotten, we must discard it.
I have tried (SR_*)+$.*(?='\s) based on what i Learned but no luck so far. Please help. Thx in Adv
For simple cases you should be able to use
Find: (\bSR_[\w]+)
Replace: $1_OLD
(\bSR_.+?)('|$) and $1_OLD$2 could also work if the text after SR_ is more complex
The lookbehind you're using is only matching the string if it ends with a ' so it won't find the text not in quotes.
regex101 is a useful tool for debugging expressions
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.
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
I have a little problem with VS2010.
So I want to find a certain strings between quotes with a Regexpression but only if the line doesn't contain a single "tr" or "QObject::tr" example:
I want to display all this lines:
Hallotr("asa");
("hhajkshjkas");
( _"hhajkshjkas" );
But don't want to display this lines:
tr("hhajkshjkas");
QObject::tr("hhajkshjkas");
My Regexp looks like this:
[^t-r]"[a-zA-Z0-9<>=\\"" ]* and ^[^tr]*"[a-zA-Z0-9<>=\\"" ]*"
but it shows all lines even if there is a single tr on the beginning of the string. Or it shows only lines which don't contain tr.
Thanks for help guys.
So I got the solution this is my regexp. :
^~((.*QObject.+tr)|(:b*tr:b*\()).*:q
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