View Single Post
02-01-2006, 04:24 PM
#2
Salathe is offline Salathe
Salathe's Avatar
Status: Community Archaeologist
Join date: Jul 2004
Location: Scotland
Expertise: Software Development
Software: vim, PHP
 
Posts: 3,820
iTrader: 25 / 100%
 

Salathe will become famous soon enough

Send a message via MSN to Salathe

  Old

Hopefully, this will help:

Code:
while ($string =~ m/(M+)/gi) {
  print "Found '$&'";
}
The important part being m/(M+)/gi which is a regular expression matching one or more letter Ms (upper and/or lower case) together. After the last slash (/) is the global modifier (matches all instances of the M groups) and the case-insensitive modifier (take the 'i' out to make the search case-sensitive).