> What you are returning here is the number if subexpressions of
> the first matching word (will always be 2), NOT the wordcount.
Damn, yes, you're right. I was thinking perl regex. Sorry!
#!/usr/bin/perl
$word = "the";
$string = "q giw fieo the nigeow the woeifnw io fmewo the miwo";
@wordarray = $string =~ /[^[:alpha:]]($word)[^[:alpha:]]/g;
print scalar(@wordarray) . "\n";
:o\
Tim.
-------------------------------------------------------
OUR NEW SITE IS NOW LIVE
Visit our new website at http://www.rawnet.com/ and
race around the beautiful Bracknell streets at
http://xmas.rawnet.com/
-------------------------------------------------------
Tim Blair
Web Application Engineer, Rawnet Limited
Direct Phone : +44 (0) 1344 393 441
Switchboard : +44 (0) 1344 393 040
-------------------------------------------------------
This message may contain information which is legally
privileged and/or confidential. If you are not the
intended recipient, you are hereby notified that any
unauthorised disclosure, copying, distribution or use
of this information is strictly prohibited. Such
notification notwithstanding, any comments, opinions,
information or conclusions expressed in this message
are those of the originator, not of rawnet limited,
unless otherwise explicitly and independently indicated
by an authorised representative of rawnet limited.
-------------------------------------------------------
[Todays Threads]
[This Message]
[Subscription]
[Fast Unsubscribe]
[User Settings]
- RE: number of occurrences in a string. Ketan Patel
- RE: number of occurrences in a string. Ketan Patel
- RE: number of occurrences in a string. Tim Blair
- RE: number of occurrences in a string. Tim Blair
- RE: number of occurrences in a string. Ketan Patel
- RE: number of occurrences in a string. Robyn Follen
- RE: number of occurrences in a string. Raymond Camden
- RE: number of occurrences in a string. Bryan F. Hogan
- RE: number of occurrences in a string. Tim Blair
- RE: number of occurrences in a string. Pascal Peters
- RE: number of occurrences in a string. Tim Blair
- RE: number of occurrences in a string. Pascal Peters
- RE: number of occurrences in a string. Raymond Camden
- RE: number of occurrences in a string. Pascal Peters
- RE: number of occurrences in a string. Pascal Peters
- RE: number of occurrences in a string. Raymond Camden
- RE: number of occurrences in a string. Raymond Camden
- RE: number of occurrences in a string. Philip Arnold
- RE: number of occurrences in a string. Raymond Camden
- RE: number of occurrences in a string. Barney Boisvert
- RE: number of occurrences in a string. Pascal Peters