in reply to regex for a phrase beginning with some chars

The \b anchor may also be useful, depending on how you define a "word":
use strict; use warnings; while (<DATA>) { print if /^ascii\b/i; } __DATA__ does not begin with ascii ascii is the one AsCii works too asciibetically sorted

Prints:

ascii is the one AsCii works too

Updated: Added "asciibetically" line to demonstrate \b (johngg++)

Replies are listed 'Best First'.
Re^2: regex for a phrase beginning with some chars
by johngg (Canon) on Feb 18, 2009 at 22:12 UTC

    I think your application of the \b anchor might better have been demonstrated with a string like "asciibetically sorted" which would show that there is no word boundary after the "ascii" part.

    Cheers,

    JohnGG