Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Need help with Regex

Name: Anonymous 2011-08-29 0:48

Ok /prog/ im lost. Why does this script do not work? what im doing wrong!?

   $a = array(
      "/^\>(.*?)\n/im"
   );
   $b = array(
      "<b>$1</b>"
   );
   $text = preg_replace($a, $b, $text);

It should grab any line starting with ">" and bold them out. Funny thing is that it works if i change ">" with "\*"

Name: Anonymous 2011-08-29 1:01

what im doing wrong!?
Can't spell. Can't code.

Name: Anonymous 2011-08-29 1:10

back to /b/, please

Name: Anonymous 2011-08-29 1:27

Damn, this board is full of elitist jerks.

Anyway already solved my problem, thank you.

Name: Anonymous 2011-08-29 1:40

I don't see any code in this thread. What is this?

Name: Anonymous 2011-08-29 2:05

















































 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Name: Anonymous 2011-08-29 5:12







Name: Anonymous 2011-08-29 5:13

toast
test
tiesto
taste

Name: Anonymous 2011-08-29 5:14

more
test

Name: Anonymous 2011-08-29 5:15

more
test
heh

Name: Anonymous 2011-08-29 5:16

and some more
testing

Name: Anonymous 2011-08-29 5:19

>>7-11
Use the force, Luke.

Name: Anonymous 2011-08-29 5:23

DJ TIESTO

Name: Anonymous 2011-08-29 9:11

>>10,11

> But can you
test this

> or this, even
I bet you can't!

Name: Anonymous 2011-08-29 11:25

. . . Now you have two problems.


   $a = array(
      "/^\>(.*?)\n/im"
   );
   $b = array(
      "<b>$1</b>"
   );
   $text = preg_replace($a, $b, $text);

Looks like Pee H Pee to me.

ummm try something like.

   $a = "/^[>](.*?)[\r\n]+$/im";
   $b = "<b>$1</b>\r\n";
   $text = "sdfsdf\r\n>sdfsdfsdf\r\n\r\n\n\ndfgsdf\n";
   $text = preg_replace($a, $b, $text);
   echo $test;

Why knows.

Name: Anonymous 2011-08-29 11:30

>>14
Ibetyoucannotdothis!

Don't change these.
Name: Email:
Entire Thread Thread List