Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9274887
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T16:27:32+00:00 2026-06-18T16:27:32+00:00

I would like to replace link texts using regex in sublime text 2 my

  • 0

I would like to replace link texts using regex in sublime text 2

my links look like this

<a href="#" class="link link1">This is a text for link 1</a>
<a href="#" class="link link2">This is a text for link 2</a>
<a href="#" class="link link3">This is a text for link 3</a>

I have more than 100 links in my page.

I have tried regex like this.

<a href="#" class="link.+">.+</a>

It works But it match the tags too.

Can anyone tell me how to match only this text This is a text for link * ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T16:27:33+00:00Added an answer on June 18, 2026 at 4:27 pm

    I don’t know why you only want to match the text, though. I can hardly think of any use case where that might be necessary. Usually capturing groups would be sufficient for most replacement scenarios.

    If the text within the tag doesn’t have any pattern, and the tag can contain arbitrary classes, then NO, it is NOT possible to do so. SublimeText seems to use Boost library, which doesn’t support variable length look-behind.

    If the tag are consistent (everything down to the spaces is the same), except for the link number in the class attribute, then it might be possible to certain extent:

    (?<=<a href="#" class="link link\d">).+?(?=</a>)
    

    If link followed by number class has 2 digits, you need to add in the corresponding look-behind:

    (?:(?<=<a href="#" class="link link\d">)|(?<=<a href="#" class="link link\d\d">)).+?(?=</a>)
    

    (\d{1,2} won’t work in look-behind. The length is not finitely many, but the regex engine doesn’t support it.)

    Working screenshot

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have index.php like this: <script type=text/javascript src=jquery-1.4.2.js></script> <script type=text/javascript src=ajax.js></script> <a href='one.php' class='ajax'>One</a>
I have some text contain html tags, I would like to replace all links
I would like to remove the text in a link and replace it with
I would like to replace blank spaces/white spaces in a string with commas. STR1=This
I have such file and I would like to replace $GLOBALS['SERVER_MEMCACHED']='localhost'; with $GLOBALS['SERVER_MEMCACHED']='mydomain.com'; using
I have the following table and would like to replace the string text of
I have this sample string where I would like to replace the star with
I would like to replace the link location (of anchor tag) of a page
I would like a way to replace the bracket text everywhere on a page
I have some html mixed with text and links and I would like to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.