[thelist] [fwd] Regex Revisited

Adrian Fischer adrian at logo-logic.com
Thu Sep 27 05:51:55 CDT 2001


---------------------------------------------
This message was held by thelist software and
is being manually forwarded by a list admin.
Please remember to send emails in plain-text
format only, or they will not reach thelist
until it is later forwarded by a list admin.
---------------------------------------------


Hi gang,

Im trying to get the first 100 characters from a paragraph with I =
extract from a mysql db.
I got it working with this bit of code

$$varDBInfo[2]=3D~/^(.{0,100})/;

$short_text=3D$1;

print "This the extract $short_text";

This is what I think its saying: ^=3Dstart of string, (.)=3Dany =
character except
new line,{0.100}=3Dfrom 0 to the 100th character.

The next hurdle seems to be if they format the text like I have in this
email, with a greeting then a comma and a new line before the message
actaully starts.  How can I change the code to allow for all that if =
they should do it but still get the 100 characters if they dont.
Are we talking if statements.  Im in perl by the way.

Do I need to add in a \n \r in there somewhere?

Your help, as always, is appreciated.

Thanks=20

Adrian





More information about the thelist mailing list