preg_match_all -- correct regular expression for string

Any questions involving matching text strings to patterns - the pattern is called a "regular expression."

Moderator: General Moderators

Post Reply
atomicc
Forum Newbie
Posts: 1
Joined: Thu Mar 04, 2010 10:51 am

preg_match_all -- correct regular expression for string

Post by atomicc »

Please, give me the correct preg_match_all code for the following string:

Code: Select all

totals">  Totals:   22   11/6       Daily Average
where I need only the number 6, nothing else. Remember that it could also be a number higher than 6, like 1598.

(I'm actually using the following code that returns the string above:

Code: Select all

 
preg_match_all('/total(.+)verage/si', $conteudo, $conteudo);
)

Thank you very much.
User avatar
tr0gd0rr
Forum Contributor
Posts: 305
Joined: Thu May 11, 2006 8:58 pm
Location: Utah, USA

Re: preg_match_all -- correct regular expression for string

Post by tr0gd0rr »

A forum isn't a great place to ask people to write code for you.

If you're not familiar with regex, you could solve your problem another way, such as with explode and trim. If you are familiar with regex or want to learn it, then you need to ask a specific question. Many people tend to ignore posts that start with "Please give me".
Post Reply