- Original Message -
From: "chen li" <[EMAIL PROTECTED]>
[snip]
I think it might be natural for me to read the file
line by line and get the return position looks like
these(just an example), similar to do the word search
in microsoft Word, which is what I really want:
match in line
On 1/4/06, chen li <[EMAIL PROTECTED]> wrote:
> I think it might be natural for me to read the file
> line by line and get the return position looks like
> these(just an example), similar to do the word search
> in microsoft Word, which is what I really want:
>
> match in line 1 and the end of matc
Hi Shashi,
Thanks for the reply.
Sorry I didn't make myself clear enough in the
previous email. If I read the whole file into an array
(@file) and then change it into a scalar($string) the
position of each word will change from the second
line. If I want to know the position of each match the
r
Hi Chen,
You can do one line at a time also.
(Also, if you read whole file, convert it into a string and work on that
string, the original file will not change.)
- Regards,
Shashi.
On 1/4/06, chen li <[EMAIL PROTECTED]> wrote:
>
> Thanks Chris and others for the information.
>
> Chris, I hav
Thanks Chris and others for the information.
Chris, I have another question: I have a file
containing multiple lines and it looks like this:
(line 1).chen.
(line 2)..
(line 3) chen.
If I read the whole file at once and change it into a
string I have no problem using
- Original Message -
From: "chen li" <[EMAIL PROTECTED]>
Hi all,
Here is my problem:
my $string="chen schen";
I want to use regular expression to find the exact
match in the string. So when I want to match "chen" I
expect "chen" only.
But use the following line I get both "chen"
Do you mean that you only want the first match, or that you only want
the word "chen" when it's not preceeded or followed by other characters?
You can use \b (word boundary) to make sure you got the whole word.
$string =~ /\b(chen)\b/g;
-Original Message-
From: chen li [mailto:[EMAIL PRO
chen li wrote:
> Hi all,
>
> Here is my problem:
>
> my $string="chen schen";
>
> I want to use regular expression to find the exact
> match in the string. So when I want to match "chen" I
> expect "chen" only.
> But use the following line I get both "chen" and
> "schen" at the same time.
> $st