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

  • SEARCH
  • Home
  • 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 4611100
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T01:13:20+00:00 2026-05-22T01:13:20+00:00

I have a problem to build good regular expressions to find and replace. I

  • 0

I have a problem to build good regular expressions to find and replace. I need to replace all urls in many .jsf files. I want replace ulrs staring by XXX with <c:url value="URL_WITHOUT_XXX"/>. Examples below.

I stuck with find regular expression "XXX(.*)" and replace expression "<c:url value="\1"/>", but my find expression match to long string , for example "XXX/a" style="", but need that match only to first " (href end). Anybody helps ?

I have:

<a href="XXX/a" style="">
<a href="XXX/b" >
<a href="XXX/c" ...>

I want:

<a href="<c:url value="/a"/>" style="">
<a href="<c:url value="/b"/>" >
<a href="<c:url value="/c"/>" ...>

PS: Sorry for my poor english 😉

Edit:
I use Find/Replace in Eclipse (regular expressions on)

  • 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-05-22T01:13:21+00:00Added an answer on May 22, 2026 at 1:13 am

    You should specify the language you’re working with.

    The following regex will match what you want:

    <a href="XXX[^\"]*"
    

    If you want to have some particular value, you can group the regex according to your needs. For example:

    <a href="(XXX[^\"]*)"
    

    will give you in the first group:

    XXX/a
    XXX/b
    XXX/b
    

    If you want to have only /a, /b, and /c, you can group it like that:

    <a href="XXX([^\"]*)"
    

    Edit:
    I will explain what <a href="XXX[^\"]*" does:

    • It will match: <a href="XXX
    • Then it should match anything that except a " zero or many times: [^\"]*
    • Finally match the ", which is not really necessary

    When you do: [^abc] you’re telling it to match anything but not a, or b, or c.
    So [^\"] is: Match anything except a ".

    And the quantifier * means zero or more times, so a* will match either an empty string, or a, aa, aaa, …

    And the last thing: Groups

    When you want to keep the value appart from the entire match, so you can do anything with it, you can use groups: (something).

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

Sidebar

Related Questions

I have problem with return statment >.< I want to store all magazine names
In our current database development evironment we have automated build procceses check all the
I'm publishing an open-source library on CodePlex, and want the dll files to have
Good evening stackoverflow. I have a problem involving JOptionPanes. Every so often they simply
I have a project where I need to build a C# application that is
I have a lot of problems getting regular expressions working for my simple Cocoa
Well, my problem is what the title says. I have build a small application
I have a problem. I built a script to make a request to an
I'm trying to build my first generic list and have run into some problems.
I have problem in some JavaScript that I am writing where the Switch statement

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.