String question

String question

am 01.07.2005 22:26:06 von GeekX

How to select substring:

from: "abcde *:; fghijkl mno pqrstuwxyz"

I want: everything between and icluding "cde" and "stu".
That is: "cde *:; fghijkl mno pqrstu"

Thanks!

Re: String question

am 01.07.2005 23:05:22 von Gunnar Hjalmarsson

GeekX wrote:
> How to select substring:
>
> from: "abcde *:; fghijkl mno pqrstuwxyz"
>
> I want: everything between and icluding "cde" and "stu".
> That is: "cde *:; fghijkl mno pqrstu"

perldoc -f substr
perldoc -f index

> Thanks!

You're welcome.

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

Re: String question

am 01.07.2005 23:12:00 von Gunnar Hjalmarsson

GeekX wrote:
> How to select substring?

Do not multi-post!!
http://www.uwasa.fi/~ts/http/crospost.html

--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl

Re: String question

am 02.07.2005 01:22:14 von Jim Gibson

In article , GeekX
wrote:

> How to select substring:
>
> from: "abcde *:; fghijkl mno pqrstuwxyz"
>
> I want: everything between and icluding "cde" and "stu".
> That is: "cde *:; fghijkl mno pqrstu"

Easiest way would be (untested):

my $substring;
my $string = 'abcde *:; fghijkl mno pqrstuwxyz';
if( $string =~ /(cde.*stu)/ ) {
$substring = $1;
}


----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---

This looks like a bug to me

am 04.07.2005 12:05:20 von George Bouras

# In any case the string is not identical to the
# number 0 so for me this is a bug.

print 'Bug !' if 'bug' == 0;

Re: This looks like a bug to me

am 04.07.2005 19:06:36 von dha

On 2005-07-04, George Bouras wrote:
> # In any case the string is not identical to the
> # number 0 so for me this is a bug.
>
> print 'Bug !' if 'bug' == 0;

No, it's not a bug, it's just the consequence of using a numeric
comparison on a string that doesn't begin with a digit.

I'm not sure where it is in the docs, but the camel has this:
""Improper conversions of a nonnumeric string like foo to a
number count as numeric 0; these trigger warnings if you have
them enabled, but are silent otherwise."

Essentially, it's just a result of the way converting a string to a
number is defined.

dha

--
David H. Adler - - http://www.panix.com/~dha/
"I'll keep him as an insurance policy, since, unfortunately, I can't
kill him twice." - Scaroth