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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T11:45:18+00:00 2026-06-07T11:45:18+00:00

I have a regular expression (REGEX 1) plus some Perl code that picks out

  • 0

I have a regular expression (REGEX 1) plus some Perl code that picks out a specific string of text, call it the START_POINT, from a large text document. This START_POINT is the beginning of a larger string of text that I want to extract from the large text document. I want to use another regular expression (REGEX 2) to extract from START_POINT to an END_POINT. I have a set of words to use in the regular expression (REGEX 2) which will easily find the END_POINT. Here is my problem. The START_POINT text string may contain metacharacters which will be interpreted differently by the regular expression. I don’t know ahead of time which ones these will be. I am trying to process a large set of text documents and the START_POINT will vary from document to document. How do I tell the a regular expression to interpret a text string as just the text string and not as a text string with meta characters?

Perhaps this code will help this make more sense. $START_POINT was identified in code above this piece of code and is an extracted part of the large text string $TEXT.

my $END_POINT = "(STOP|CEASE|END|QUIT)";

my @NFS = $TEXT =~ m/(($START_POINT).*?($END_POINT))/misog;

I have tried to use the quotemeta function, but haven’t had any success. It seems to destroy the integrity of the $START_POINT text string by adding in slashes which change the text.

So to summarize I am looking for some way to tell the regular expression to look for the exact string in $START_POINT without interpreting any of the string as a metacharacter while still maintaining the integrity of the string. Although I may be able to get the quotemeta to work, do you know of any other options available?

Thanks in advance for your help!

  • 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-07T11:45:20+00:00Added an answer on June 7, 2026 at 11:45 am

    You need to convert the text to a regex pattern. That’s what quotemeta does.

     my $start = '*';
     my $start_pat = quotemeta($start);  # * => \*
     /$start_pat/                        # Matches "*"
    

    quotemeta can be accessed via \Q..\E:

     my $start = '*';
     /\Q$start_pat\E/                    # Matches "*"
    

    Why reimplement quotemeta?

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

Sidebar

Related Questions

I have a regular expression as: Regex regExpForPurchaseIndent = new System.Text.RegularExpressions.Regex(^(([0-9]*[a-zA-Z]*)*[, ]*)*$;); The string
I have a regular expression that is getting some information from a string. I
I have this regular expression that removes html : sr.Text = Regex.Replace(sr.Text, @<[^>]*>, );
I have these variables: boost::regex re //regular expression to use std::string stringToChange //replace this
Possible Duplicate: regexp with russian lang I have a regular expression that filters out
I've spent some time, but still have to solution. I need regular expression that
I am looking to have a regular expression that allows only specific numbers to
I have this Regular Expression that matches the following strings: <!-- 09-02-2009 ---> <!--
I have this regular expression: regex = %r{\A(?<foo> a\g<foo>a | b\g<foo>b | c)\Z}x When
I have a regular expression, defined in a verbatim C# string type, like so:

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.