regex - regular expression search replace in Sublime -
I have a number of php files that should be replaced, and I decided to use sublime for it. Now I type lines such as
& lt; Td width = "17%" class = "listhdrr" & gt; & Lt ;? = Gettext ("some text") ;? & Gt; & Lt; / Td>
to
& lt; Th & gt; & Lt ;? = Gettext ("some text") ;? & Gt; & Lt; / Th & gt;
I
& lt; Td width = "\ d +%" class = "listhdrr" & gt; & Lt; \? = Gettext \ ("[/ A-Za-z \ s +]" \); \ & Gt; & Lt; / TD & gt;
Regular expression I do not need the column width of the table, but for example I need some text .
My Replacement Expressions
; By & gt; ;; = Gettext ("$ 1") ;? & Gt; & Lt; / Th & gt; Or & lt; Th & gt; & Lt ;? = Gettext ("\ 1") ;? & Gt; & Lt; / V & gt;
replace some text part
& lt; Td width = "\ d +%" class = "listhdrr" & gt; & Lt; \? = Gettext \ ("(. +)" \); \ & Gt; & Lt; \ / Td>
and use it for replacement;
& lt; Th & gt; & Lt ;? = Gettext ("$ 1") ;? & Gt; & Lt; / V & gt;
To use $ 1 in a match, you need the bracket around the area you want to catch;
gettext (" (. +) ")
Comments
Post a Comment