Error in replacing string with Perl, it’s time to investigate our English! Quantifier means a quantifier. The reason is that we use variables as matching pattern strings, which contain quantifiers, resulting in recognition errors. How to solve it?In fact, we can completely replace functions with strings instead of regular replacement. Unfortunately, Perl doesn’t seem to have a string replacement function! Fortunately, we found an example of the string wrapped by the pattern string: [pl] # if the pattern string adopts the variable method and the quantifier appears in the variable, the error sub testquantityerror {my $STR = – he * LLO} will appear; my $match = “e*” ; #$ match =~ s/\*/\\*/ ; In the previous method, replace the quantifier, but this will change the source string, not if ($STR = ~ m/\ q $match/E /) {print “match”;}}[/ pl]
Similar Posts:
- [LeetCode] 291. Word Pattern II
- Can’tlocate cpan.pm in@inc [How to Solve]
- [Solved] Uncaught syntax error: invalid regular expression flags
- How to Solve JavaScript Error: replaceAll is not a function
- [Solved] PHP Error: ErrorException: preg_match(): Compilation failed: invalid range in character class at offset …
- java.lang.IllegalArgumentException: Illegal group
- One line command / usr / bin / Perl ^ m: bad interpreter
- TypeError: cannot use a string pattern on a bytes-like object
- What happened to CodeIgniter disallowed key characters?
- core-js & RegExp error All In One [How to Solve]