Dúvia match perl

Asked

Viewed 61 times

1

I need a perl help for a match in regular expression... But it’s the opposite of what usually happens....

I need to do a match on the following.

I have the number "(0003[6-9])|(00041)|:.:30/30", the delimiter is the two points, however, I needed to test if a certain number will match in these columns... Finally I needed to know if there is a way to test a number in a regular expression.

Thank you.

  • I don’t understand your problem. Yes, it is possible to match for a specific number. Put examples of texts you need to match that I can help you with Regular Expression.

  • I want to test if the number 00038 matches this column: (0003[6-9])|(00041) But I have lines where it contains . * in this file that is equivalent to a line that in sequence order it should match in the first instance, e.g.: line1: . * Linha2: (0003[6-9])|(00041) In this case the match should occur on line 1. Got it?

  • No. The regex "(0003[6-9])|(00041)" matches 00038 yes: https://regex101.com/r/mN4vZ6/1

  • I know it does..... But when I try to buy in perl if 00038 matches in (0003[6-9])|(00041) it returns empty.... got it? That’s the problem.... the input is 00038 which must be checked within the expression.

  • Now I get it. Since your problem is in Perl, you put chunks of your code, there might be something wrong with it.

  • if ("00038" =~ /(0003[6-9])|(00041)/){ print "faz\n" } ?

Show 1 more comment
No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.