For example regex:
- Code: Select all
^( *)([ a-zA-Z$()]+(\)|else)) *{$

and to code to test it against:
- Code: Select all
<?php
$blah = 0;
if ($blah) {
}
else{
}
if ($blah) {
}
else{
}
?>
It find all the "if" and "else" lines ok, but sometimes it doesn't select the whole line.
And when I try use this regex in replace, the result is even weirder:
Replacement string:
- Code: Select all
\1\2\n\1{
(the idea it should move "{" from the end of the new line and add spaces if necessary)
The expected result:
- Code: Select all
<?php
$blah = 0;
if ($blah)
{
}
else
{
}
if ($blah)
{
}
else
{
}
?>
Actual result:
- Code: Select all
<?php
$blah = 0;
if ($blah)
{
}
else{
{
}
if ($blah)
{
}
else{
{
}
?>
Now, when I try put entire line in a group:
- Code: Select all
^(( *)([ a-zA-Z$()]+(\)|else))) *{$
UES doesn't find anything at all.
[EDIT]
When I tested it using instructions above I got a weird bug after used "replace all" and then "undo" - it totally destroyed the original code. This happened to me several times in different accusations, but I blamed it on incorrect handling pasted Unicode text into non-Unicode file and then undo, this time is a totally different bug, yet same result.



