First here are the docs on the syntax (of course I looked for this after I finished my task, so below may not be the best example): http://msdn.microsoft.com/en-us/library/aa293063(VS.71).aspx
Here are the two expressions I ended up with (I'm sure they could be better):
Find: ^{:b*}proxy\::b*new Ext.data.AspNetAjaxHttpProxy.*\n[^'"]*['"]{[^'"]*}['"]\n[^,]*
- A line that starts with some white space captured
- then "proxy:"
- then some white space
- then "new Ext.data.AspNetAjaxHttpProxy"
- then any characters to the end of the line
- then new line
- then any characters except a single or double quote
- then a single or double quote
- then capture the characters inside of the quotes
- then a new line
- then any characters that are not a comma
- fill in with the whitespace captured in step 1 above
- then insert "proxy: window.getProxy(
- then the chars capterd in step 9 above
- then insert )
Find: ^{:b*}reader\::b*new Ext.data.JsonReader\(.*\n.*\n[^,]*,:b*
Replace: \1reader\: window.getJSONReader(
Some of the things I learned:
- There is multi-line support, but it's not great
- I would have been better off using :q for my quoted string in the first example
- You can do grouping with "()" to capture n number of \n characters. I didn't know about this at the time, but could have used it where I have back to back ".*\n" sequences.
- Capture groups are pretty easy using "{}" and replacing with "\n" where 'n' is the 1 based index of the capture.
0 comments:
Post a Comment