RE: String Manipulation



But in this case it was also not needed as I replied without actually
reading the requirements.

-----Original Message-----
From: Paul Lalli [mailto:mritty@xxxxxxxxx]
Sent: 31 July 2007 14:21
To: beginners@xxxxxxxx
Subject: Re: String Manipulation

On Jul 31, 8:40 am, dharshana...@xxxxxxxxx (Dharshana Eswaran) wrote:
And your suggestion worked. Thank you. But in the string which u had
suggested, [,\s*\/*]?, here \s* => tells spaces are optional,

No it doesn't. The "dirty dozen" characters lose their special meaning
inside of a character class.

/\* tells the beginning of the comment,

That's not what's in the pattern, and it wouldn't be correct even if it was.
The characters are \/*, not /\*. The first is an escaped slash follwed by
an asterisk, the second is a slash followed by an
escaped asterisk. The slash is still special because it's the regexp
delimiter, and so needs to be escaped. Your changing it is a syntax error.

I am unable to understand what these in a square bracket along with a
? mean?

The square brackets are a character class. Essentially, a list of options.
[,\s*\/*]?
means "0 or 1 of either a comma, a space, an asterisk, a slash, or an
asterisk". Obviously, the two asterisks are redundant.

You should freshen up on regular expressions:
perldoc perlreref
perldoc perlretut
perldoc perlre

Paul Lalli


--
To unsubscribe, e-mail: beginners-unsubscribe@xxxxxxxx For additional
commands, e-mail: beginners-help@xxxxxxxx http://learn.perl.org/



This e-mail is from the PA Group. For more information, see
www.thepagroup.com.

This e-mail may contain confidential information. Only the addressee is
permitted to read, copy, distribute or otherwise use this email or any
attachments. If you have received it in error, please contact the sender
immediately. Any opinion expressed in this e-mail is personal to the sender
and may not reflect the opinion of the PA Group.

Any e-mail reply to this address may be subject to interception or
monitoring for operational reasons or for lawful business practices.




.



Relevant Pages

  • Re: String Manipulation
    ... slash follwed by an asterisk, the second is a slash followed by an ... escaped asterisk. ... The square brackets are a character class. ...
    (perl.beginners)
  • Re: String Manipulation
    ... slash follwed by an asterisk, the second is a slash followed by an ... escaped asterisk. ... The square brackets are a character class. ...
    (perl.beginners)
  • Re: Regex question
    ... First, if you're using character sets, there's no need to use a or in there. ... This will capture all directories until it can no longer find a trailing slash. ... It will capture any chracter that isn't a singel or double quote. ... The last would even be optional as it's already caught by the filename expression. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Shame and humiliation...
    ... the sexual orientation of someone's already established character? ... The reason I don't "get" slash is that if there's a male character in a TV show, film or book that I fancy, I want him to be miiiiiine! ... They do have an intense friendship, though neither of them would be the least bit interested in each other in that way and they both eventually find and settle down with compatible women. ... I do have gay characters in the stories, so if a character is gay, I won't be hiding that fact. ...
    (rec.arts.sf.composition)
  • Re: finding specific sequence of wildcard characters
    ... to find single instances of the "*" character (i.e., the asterisk ... please post all follow-ups to the newsgroup so ...
    (microsoft.public.word.docmanagement)