Kevin Viel wrote: > Greetings, Hello,
> I have a field that a user must enter that must be in a specific > format. For example: > > F8_A000001F0123 > > The pertinent parts are F8, A, 000001, F, 0123, while the underscore is > a separator. > > I have come up with the following regular expression to match this pattern. > > $reverse =~ /^[a-zA-Z0-9]+_A|a[0-9](F|R)[0-9](1-4)$/ Your pattern says to match '^[a-zA-Z0-9]+_A' *OR* match 'a[0-9](F|R)[0-9](1-4)$'. It looks like you may need something like: $reverse =~ /^[a-zA-Z0-9]+_[Aa]\d+[FR]\d{1,4}$/ > I am unsure if I need to group the relevant parts using (). Could > anyone advise or is the use of the anchor sufficient? If you just want to group elements use (?:) unless you want to capture the contents of the parentheses. John -- use Perl; program fulfillment -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] <http://learn.perl.org/> <http://learn.perl.org/first-response>