VS2010 Find and Replace - regex

I need help using regular expressions using Find and Replace in VS2010. I want to
Find request("somevar") and replace it with html_encode(request("somevar"))
somevar will be a different for each request("")

Replace request({:q}) with html_encode(request(\1)).

Related

Netbeans regular expression search and replace

I would like to find and replace in project on netbeans by using regular expression.
Find
$_SESSION['anything']['anything']
Replace with
$this->Session->read('anything.anything');
Please help.
You could accomplish this in the following way ...
Find \$_SESSION\['(.*?)'\]\['(.*?)'\]
Replace with \$this->Session->read('$1.$2');
see regex demo / explanation

Find and replace using regular expressions (regex) in visual studio?

I am converting from VB.net to C#.Net.
I need to replace Session("something") or Session("Others") to Session["something"] or Session["Others"] in the whole project. What regex i need to use in the find box and what's in the replace box. Any help would be appreciated.
Make sure you check on the option use the regular expression.
Find what: Session\("{.*?}"\)
Replace with: Session["\1"]
Note: using lazy operator ? here is try to stop when finding the first match. Thus, it should be able to handle cases like:
Session("Types") = new SelectList(xxx, "Code", "Description");
((((Session("something)))))))))"))))
P.S.: In VS2013, you should use the following instead:
Find what: Session\("(.*?)"\)
Replace with: Session["$1"]

Regex to modify an html tag

I am trying to replace
<legend>my legend</legend>
with
<legend><span>my legend</span></legend>
Intellij/Webstorm,supports regexp match and replace.
I tried along the examples here, but didn't work.
Any help on a regexp to find and replace as described above is appreciated.
I use mac, so gnu command line tools also an option (sed,..)
Thanks.
Use replace with the following regular expression:
<legend>([^<]*)</legend>
and replacement
<legend><span>$1</span></legend>

To lower case using Find and Replace with regular expression in Visual Studio 2010

I am using the Find and Replace function in Visual Studio 2010 in order to change the coding style for fields.
All instances similar to
m_MyField
should be
_myField
but I can only manage to get
_MyField
using
Find what: m_{[a-zA-Z]}
Replace with: _\1
How do I make the first letter lower case? I have tried the following but it does not work:
Find what: m_{[a-zA-Z]}
Replace with: _\L\1
I found this explained in http://vim.wikia.com/wiki/Changing_case_with_regular_expressions but it only works for vim I think.
Any suggestions are welcomed.
I would use this approach:
Find what: m_A{[a-zA-Z]}
Replace with: _a\1
and repeat it for B..Z
Not elegant but should be done quick.

Find & replace with regular expressions in netbeans

I'm looking for a regular expression that can find and replace all the text "anytext" with "anything" in netbeans, some of the symbols also contain this text. I've done it a while back for a single file but now I want to change everything in my application & I'm struggling to get it right.
Just use find & replace to replace all instances of "anytext" with "anything". There is no difference between this and a regex find & replace, because there doesn't exist a pattern that can be easily exploited using regex. There is no difference in this case. Based on your comment, you still must manualy enter the word you want replaced and a word that will replace it.
I think you have misunderstood a bit what regular expressions are all about.
Were you looking for something like this? Where it wouldn't grab it inside word?
\banytext\b