Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Any ideas, without touching each character in the string?#!/usr/bin/perl -w use strict; my $variable = "123g 321 123 g 321"; if ($variable =~ /g/) { #need the position of the first g here #which, should be 3 }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Matching pattern in regular expression with string position
by BrowserUk (Patriarch) on Aug 09, 2003 at 12:46 UTC | |
by diotalevi (Canon) on Aug 09, 2003 at 13:24 UTC | |
by sauoq (Abbot) on Aug 09, 2003 at 19:18 UTC | |
|
Re: Matching pattern in regular expression with string position
by Not_a_Number (Prior) on Aug 09, 2003 at 13:43 UTC |