#!/usr/bin/perl use strict; # https://perlmonks.org/?node_id=11132725 use warnings; while( <DATA> ) { print /(?<!\d)5\d{8}(?!\d)/ ? ' ' : 'not', " found in : ", $_; } __DATA__ for me. "503009496" and i w for me. "603055496" and i w (6) for me. "703509496" and i w (7) for me. "53009496" and i w (too short) for me. "5093009496" and i w (too long) for me. "503009496" and i w
Outputs:
found in : for me. "503009496" and i w not found in : for me. "603055496" and i w (6) not found in : for me. "703509496" and i w (7) not found in : for me. "53009496" and i w (too short) not found in : for me. "5093009496" and i w (too long) found in : for me. "503009496" and i w
In reply to Re: Need a regular expression to check the first digit
by tybalt89
in thread Need a regular expression to check the first digit
by chandantul
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |