Advertisement

08.20.2008 at 11:42AM PDT, ID: 23664221
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.7

Which function should I use?

Asked by akohan in PHP Scripting Language, Regular Expressions

Tags: ,


Hello group,

I need to use Regular Expresesions in my code and need to know which RE functions I must use? as input I receive some data such as user_agents and have to remove some of the tokens (after finding a match). Now, I have tested the patterns in an editor (for regular expersesion) and have to put it in PHP code. However, we have:

preg_replace()
ereg_replace()


first I did start off with preg_replace() since I thought it is Perl_Compatible but didn't work at all (still trying to figure out) then I tried ereg_replace() and it worked fine. But base on what I read in book I have a feeling I must use preg_replace().

Any advice is appreciated.

Regards.
Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
//this is a sample
 
$source = "Mozilla/4.0 (compatible; MSIE 6.0; Windows CE; IEMobile 7.6) compatible; MSIE 6.0; Windows CE; PPC; 240x320; HPiPAQ610/1.0 Mozilla/4.0";
print "\n 0=> " . $source . "\n";
 
$source = ereg_replace("(Ser|MS)?IE(S?|Mobile)[[:space:]]([0-9]*)?(\.)?([0-9]*)?", "", $source);
print "\n 1=> " . $source . "\n";
 
outputs:
 
 (eliminating tokens such as MSIE 6.0 and IEMobile 7.6)
 0=> Mozilla/4.0 (compatible; MSIE 6.0; Windows CE; IEMobile 7.6) compatible; MSIE 6.0; Windows CE; PPC; 240x320; HPiPAQ610/1.0 Mozilla/4.0
 1=> Mozilla/4.0 (compatible; ; Windows CE; ) compatible; ; Windows CE; PPC; 240x320; HPiPAQ610/1.0 Mozilla/4.0
 
 
//ends
[+][-]08.20.2008 at 11:52AM PDT, ID: 22272722

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: PHP Scripting Language, Regular Expressions
Tags: PHP, 5
Sign Up Now!
Solution Provided By: ddrudik
Participating Experts: 2
Solution Grade: A
 
 
[+][-]08.20.2008 at 11:58AM PDT, ID: 22272771

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.20.2008 at 12:00PM PDT, ID: 22272795

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.20.2008 at 12:02PM PDT, ID: 22272806

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.20.2008 at 12:04PM PDT, ID: 22272826

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.20.2008 at 12:05PM PDT, ID: 22272837

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.20.2008 at 12:06PM PDT, ID: 22272844

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.20.2008 at 12:07PM PDT, ID: 22272861

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.20.2008 at 12:21PM PDT, ID: 22273001

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.20.2008 at 12:23PM PDT, ID: 22273014

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.20.2008 at 12:29PM PDT, ID: 22273062

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.20.2008 at 12:42PM PDT, ID: 22273187

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.20.2008 at 01:00PM PDT, ID: 22273312

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.20.2008 at 01:05PM PDT, ID: 22273356

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.20.2008 at 01:13PM PDT, ID: 22273421

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.20.2008 at 01:14PM PDT, ID: 22273438

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.20.2008 at 01:19PM PDT, ID: 22273483

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.20.2008 at 01:24PM PDT, ID: 22273521

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.20.2008 at 01:37PM PDT, ID: 22273640

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]08.20.2008 at 05:27PM PDT, ID: 22275204

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.20.2008 at 05:50PM PDT, ID: 22275307

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.20.2008 at 06:38PM PDT, ID: 22275534

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 30-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]08.28.2008 at 12:14PM PDT, ID: 22338674

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 30-day free trial to view this Expert Comment or ask the Experts your question.

 
 
Loading Advertisement...
20081112-EE-VQP-44 / EE_QW_2_20070628