regular expression search replace in Sublime

Mahmood Kohansal

I have a lot of php files that must be changed, and I decided to use Sublime for it. Now I want to change lines like

<td width="17%" class="listhdrr"><?=gettext("SOME TEXT");?></td>

to

<th><?=gettext("SOME TEXT");?></th>

I used

<td width="\d+%" class="listhdrr"><\?=gettext\("[A-Za-z\s+]+"\);\?></td>

regular expression. I don't need width of table's column but I want SOME TEXT in example.

My Replace expression was

<th><?=gettext("$1");?></th>  OR <th><?=gettext("\1");?></th>

that doesn't work for replace SOME TEXT Part.

Novocaine

Try the following;

<td width="\d+%" class="listhdrr"><\?=gettext\("(.+)"\);\?><\/td>

And use this for the substitution;

<th><?=gettext("$1");?></th>

To make use of the $1 in the match you need the brackets around the area you want to catch;

gettext("(.+)")

DEMO

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

Regular expression search replace in Sublime Text 2

From Dev

replace regular expression in sublime text

From Dev

Regular expression: Search/replace

From Dev

Search And Replace With Regular Expression webuilder

From Dev

PhpStorm regular expression search and replace it

From Dev

Regular expression replace using Sublime Text 3

From Dev

Find and replace with regular expression in Sublime Text 2

From Dev

Regular Expression search for sublime3

From Dev

Dreamweaver help needed with regular expression search and replace

From Dev

Replace regular expression placeholder followed by number in Sublime Text 2

From Dev

replace text with regular expression keeping structure match on sublime text

From Dev

How to replace text wrapped by tabs using regular expression and Sublime Text?

From Dev

PHP Sublime Text Use Find and Replace Regular Expression

From Dev

Sublime Text - Search and Replace

From Dev

Vim - incremental numbering via regular expression search and replace

From Dev

Multiple search and replace within a string through regular expression in SAS

From Dev

Search and replace in only certain tags and attributes in XML file by a regular expression

From Dev

Regular expression substitution in sublime text

From Java

Regular expression replace with self

From Dev

XSLT + regular expression replace

From Dev

Regular expression failed replace

From Dev

Regular expression to replace text

From Dev

Regular expression to replace a string

From Dev

Regular expression replace [*

From Dev

Find and replace regular expression

From Dev

Regular Expression to replace AND

From Dev

regular expression to replace div

From Java

Regular expression to search for Gadaffi

From Dev

Pip regular expression search

Related Related

  1. 1

    Regular expression search replace in Sublime Text 2

  2. 2

    replace regular expression in sublime text

  3. 3

    Regular expression: Search/replace

  4. 4

    Search And Replace With Regular Expression webuilder

  5. 5

    PhpStorm regular expression search and replace it

  6. 6

    Regular expression replace using Sublime Text 3

  7. 7

    Find and replace with regular expression in Sublime Text 2

  8. 8

    Regular Expression search for sublime3

  9. 9

    Dreamweaver help needed with regular expression search and replace

  10. 10

    Replace regular expression placeholder followed by number in Sublime Text 2

  11. 11

    replace text with regular expression keeping structure match on sublime text

  12. 12

    How to replace text wrapped by tabs using regular expression and Sublime Text?

  13. 13

    PHP Sublime Text Use Find and Replace Regular Expression

  14. 14

    Sublime Text - Search and Replace

  15. 15

    Vim - incremental numbering via regular expression search and replace

  16. 16

    Multiple search and replace within a string through regular expression in SAS

  17. 17

    Search and replace in only certain tags and attributes in XML file by a regular expression

  18. 18

    Regular expression substitution in sublime text

  19. 19

    Regular expression replace with self

  20. 20

    XSLT + regular expression replace

  21. 21

    Regular expression failed replace

  22. 22

    Regular expression to replace text

  23. 23

    Regular expression to replace a string

  24. 24

    Regular expression replace [*

  25. 25

    Find and replace regular expression

  26. 26

    Regular Expression to replace AND

  27. 27

    regular expression to replace div

  28. 28

    Regular expression to search for Gadaffi

  29. 29

    Pip regular expression search

HotTag

Archive