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 9149793
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:31:31+00:00 2026-06-17T11:31:31+00:00

I’m trying to use Regular Expressions to Find and Replace some text in a

  • 0

I’m trying to use Regular Expressions to Find and Replace some text in a folder of documents. My problem is that when the text appears twice in the same line, the Regular Expression “finds” the match by running the two expressions together from the start of the first to the end of the second.

Here is my attempt at the regular expression:

\\x.*\\x\*

The text I am trying to match starts with \x and ends with \x*.

This first example contains one match:

2Y Sara concibió \x a \xo 21.2: \xt Heb
11.11.\x*
y le dio un hijo a Abrahán en su vejez, en el tiempo preciso que Dios le había anunciado.

This second example contains two matches, but they are run together by the regular expression:

2Los creó hombre y mujer,\x a \xo 5.2: \xt Mt
19.4; Mc 10.6.\x* y los bendijo.\x b \xo 5.1-2: \xt Gn 1.27-28.\x*
El día en que fueron creados les puso por nombre Adán.

I’ve never become proficient at regular expressions because of frustrations like these… always sounds like a great idea. But I’m trying to learn!

  • 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-17T11:31:32+00:00Added an answer on June 17, 2026 at 11:31 am

    Your .* matches asterisks as well. By default regular expressions are greedy: They match as many characters as they can, and then proceed backwards until the match is successful.

    One option is to follow the .* with a question mark, creating .*?. This syntax insists that the match be non-greedy, so it matches the fewest characters possible. Syntax with a trailing ? is compatible in Perl, ECMA, Java, and most other implementations aside from POSIX/GNU implementations. ie like this:

    \\x.*?\\x\*
    

    Your alternative is to match all characters except asterisk, which in regular expressions looks like [^*]*. This, however, will prevent you from matching any asterisks in the character string, even those not preceded by backslashes.

    (Thank you lxop for noting the errata!)

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

Sidebar

Related Questions

I'm trying to convert HTML to plain text. I get many &\#8217; &\#8220; etc.
I'm trying to use string.replace('’','') to replace the dreaded weird single-quote character: ’ (aka
I am trying to understand how to use SyndicationItem to display feed which is
I am trying to find ID3V2 tags from MP3 file using jid3lib in Java.
I've got a string that has curly quotes in it. I'd like to replace
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I'm trying to create an if statement in PHP that prevents a single post
I have a reasonable size flat file database of text documents mostly saved in
I am trying to loop through a bunch of documents I have to put
I'm working with an upstream system that sometimes sends me text destined for HTML/XML

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.