Search
Left Quote    I start where the last man left off.
- Thomas A. Edison    
Right Quote
 
[login] | [Register]
Forum Index » PHP and mySQL » Viewing Topic and Replies
Post Reply


        Viewing Topic: Reg Expression
  This user is offline  David1159
  Subject: "Reg Expression" Posted: @ 9:39 pm on Dec 24 2009   

Member #: 526
Rank: User - (81)
Since: 12/27/07
Posts: 81
From: usa


Code:
/\[quote\=(.*? )\](.*?)\[\/quo te\]/



Issue with this is it doesn't allow multiple lines due to the dot only allows all characters except newline. I been trying to figure out, but nothing is working.

Does any one know how to fix it to do multiple lines.


Coding is simply CST... Combining $hit Together. We make different $hit to run in unison correctly.
    Viewed: 6,649 Times | Reply to This | To top
  This user is offline  misterhaan
  Subject: "re: Reg Expression" Posted: @ 6:07 am on Dec 25 2009    

Member #: 5
Rank: User - (213)
Since: 02/11/05
Posts: 148
From: chair

the default mode for regular expressions is to process each line individually, so it's not that . matches anything but newlines -- it's just that newlines are never included in what gets processed.

you need to put it in multiline mode to get the newlines included. I'm pretty sure it's a flag you pass to the preg_* functions but it's been a while




please note that the above post is likely made up in its entirety.

    Viewed: 6,641 Times | Reply to This | To top
  This user is offline  David1159
  Subject: "re: Reg Expression" Posted: @ 7:05 am on Dec 25 2009    

Member #: 526
Rank: User - (81)
Since: 12/27/07
Posts: 81
From: usa

Cool thanks misterhaan. I'll check it out tomorrow. I hope it is as simple as that, I didn't pay much attention to reg expressions in class , should have...

I wonder if just the php str_replace() would be the best option. I only need to do it twice, once for the beginning of quotes and ending of quotes... hmm. Then again, that means twice the run time in the search...

I have an old board I made, I am upgrading it to a new ajax based board I made. I didn't allow quoting on the old board, so line breaks were not a issue before. The ajax board should cut down on bandwidth and database grabs in theory lol since everything is loaded once as their own object, so only one of the many objects are changed at any time.



Edited at 07:19:28 am on 12/25/09


Coding is simply CST... Combining $hit Together. We make different $hit to run in unison correctly.

    Viewed: 6,636 Times | Reply to This | To top
Viewing Page: 1 of 1


1 |

You must be logged in to post on the forums. Login or Register








"AllSyntax.com" Copyright © 2002-2017; All rights lefted, all lefts righted.
Privacy Policy  |  Internet Rank