Freelancers Network
 
skill list top cap
Homepage
Join the Freelancer's Network
Update your details
Find a freelancer
Post a project
Find a project
Projects Archive
Post a job
Find a job
Jobs Archive
See Dan's Pages
See Andy's Pages
Link to this site
Resources
Join/Leave Forum
Forum Messages
+Additions+ Adverts
Advertising
Contact Us
Subscribe to our newsletter - enter your email address and hit return
Freelancers.net is owned and operated by Andy Stowell and Dan Winchester
skill list end cap
guru web hostcom

Find me again on Freelancers.net

Re: FN-FORUM: Reg Expr: any character conundrum!

date posted 20th June 2007 00:31

----- Original Message -----
From: "Ben Johnson (Neogic) F" [EMAIL REMOVED]

/[.\n]+/ Match a mix of one or more chars incl. newlines (i.e., ANY
char)?

Wrong! The final example will not match across newlines. Try in your address
bar:


Unless you tell them otherwise, most regex engines will only look at one
line of text at a time. I don't know about javascript regex, but in perl,
/./s treats the entire input string as a single string, and then the . will
also match newlines.

Using /m will let $ (and ^) match before (after) any newline char. \z will
restrict to matching at the very end of the whole string - it's an anchor
like $; and \Z will match at the end of the string or before any newline.
The . metachar will not match a newline if you only have /m (it will if you
have /ms )

If you have the /s modifier turned on, [:cntrl:] will match a newline
(amongst other things).

Hope this helps - check out
http://www.regular-expressions.info/modifiers.html and
http://perldoc.perl.org/perlre.html . The bottom line is to try testing it
with your given retgex engine, sigh loudly, complain it doesn't work like
perl does, then try to find another way around the problem!!!!

Good luck,
Matt



Messages by Day
June 30th 2007
June 29th 2007
June 28th 2007
June 27th 2007
June 26th 2007
June 25th 2007
June 24th 2007
June 23rd 2007
June 22nd 2007
June 21st 2007
June 20th 2007
June 19th 2007
June 18th 2007
June 17th 2007
June 16th 2007
June 15th 2007
June 14th 2007
June 13th 2007
June 12th 2007
June 11th 2007
June 10th 2007
June 9th 2007
June 8th 2007
June 7th 2007
June 6th 2007
June 5th 2007
June 4th 2007
June 3rd 2007
June 2nd 2007
June 1st 2007


Messages by Month
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007


Messages by Year
2008
2007
2006
2005
2004
2003
2002
2001
2000