Welcome to WebmasterWorld Guest from 3.233.226.151

Forum Moderators: coopster & jatar k

Message Too Old, No Replies

Match multiple periods?

     
2:33 pm on Nov 27, 2006 (gmt 0)

Junior Member

10+ Year Member

joined:Nov 29, 2003
posts:94
votes: 0


Just a quick one, im having difficulty matching dots .... with preg match.

Im just checking a string to see if it contains 3 or more fullstops in a row.

preg_match("/.../")
or
preg_match("/\.\.\./")

dont seem to work, i get pretty stuck on what needs backslashing etc

Can any one help, Thanks

3:12 pm on Nov 27, 2006 (gmt 0)

Junior Member

10+ Year Member

joined:Apr 17, 2006
posts:195
votes: 0


The second regex [php.net] is ok:

preg_match("/\.\.\./", $str)
9:49 pm on Nov 27, 2006 (gmt 0)

Administrator

WebmasterWorld Administrator coopster is a WebmasterWorld Top Contributor of All Time 10+ Year Member

joined:July 31, 2003
posts:12555
votes: 3


Optional syntax [php.net] might look something like this ...
$pattern = "/\.{3,}/";