#1
  1. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    May 2006
    Location
    England
    Posts
    634
    Rep Power
    58

    Remove new lines at start?


    Okay i have a quote bbcode i want to strip any new lines at the start of, currently have this:

    Code:
    #\[quote\](.*?)\[/quote\]#mi
    I have a regex cheat sheet but i've tried and failed
  2. #2
  3. Did you steal it?
    Devshed Supreme Being (6500+ posts)

    Join Date
    Mar 2007
    Location
    Washington, USA
    Posts
    14,068
    Rep Power
    9398
    What if you made the capturing group skip over any whitespace at the beginning? So immediately after the "[quote]" might come whitespace, and then (this is where the capturing starts) comes the quote itself.
  4. #3
  5. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    May 2006
    Location
    England
    Posts
    634
    Rep Power
    58
    Actually figured it out by using:
    (?:\r\n?|\n)
  6. #4
  7. Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    May 2006
    Location
    England
    Posts
    634
    Rep Power
    58
    Hmm after testing this only works if there is a space, if i do anything right next to the quote bbcode tag it stops parsing it...any advice?

IMN logo majestic logo threadwatch logo seochat tools logo