RegEx

RegEx never seems to be easy when I am trying to set up a find or a replace, but then when it works it just works.

Well this query half-worked at least

I wanted to replace
the square brackets here
$h->lang["post_images_settings_url"]
with round ones

I used this as the find
\$h->lang\[(.*)\]

and this as the replace
$h->lang($1)

Generally it provided this result
$h->lang("post_images_settings_url")

but occasionally it went to the farthest ] it could find on the line and messed things up a bit.
I cant remember the character to use in the search to tell it stop after the first ] found

Also, along the way I found this helpful site for testing

http://www.regular-expressions.info/javascriptexample.html

This entry was posted in Uncategorized and tagged , . Bookmark the permalink.

Leave a Reply