perl - Using a match from a regex in another regex: skipping over metacharacters -


I have a regular expression (Reggae1) plus some Perl code that selects a specific string of text, it has to be shared with theSTART_POOINT, This is the start of a big string from a large text document that I want to remove from a larger text document. I want to use another regular expression (REGEX 2) to remove from START_POINT to END_POINT. I have a set of words to use in regular expressions (REEGEx 2), which will easily get END_POINT. Here's my problem. START_POINT Text strings can include metaccharuchers, which will be interpreted differently by regular expressions. I do not know the time before that who will be this. I am trying to process a large set of text documents and will be different in the document from the START_POINT document. How can I define a text string as a text string and with meta characters? Not in the form of text string?

Perhaps this code will help to understand more than $ START_POINT has been identified in the code above this part of the code and the large text string is an extracted part of $ TEXT.

  My $ END_POINT = "(STOP | CEASE | END | QUIT)"; My @NFS = $ TEXT = ~ m / (($ START_POINT). *? ($ END_POINT)) / False;   

I have tried to use the Cometa function, but I have not had any success. It seems that by adding text to the changing slash, destroying the integrity of the $ 15 IOT text string.

In short, I use regular expressions to define any string as a metacharacter without maintaining the integrity of the string, without any explanation, to see the exact string in the $ START_POINT I am searching. Although I may be able to get the coatmata to work, do you know about any other option?

Thank you in advance for your help!

You have to convert the text to a regex pattern. This is what quotemeta does.

  My $ start = '*'; My $ start_pat = quotemeta ($ start); # * = & Gt; \ * / $ Start_pat / # matches = "*"   

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

  My $ start = '*'; / \ Q $ start_pat \ E / # matches "" "  

Why reimplement quotemeta ?

Comments

Popular posts from this blog

Python SQLAlchemy:AttributeError: Neither 'Column' object nor 'Comparator' object has an attribute 'schema' -

java - How not to audit a join table and related entities using Hibernate Envers? -

mongodb - CakePHP paginator ignoring order, but only for certain values -