|
|
|
#1 |
|
Messages: n/a
Hébergeur: |
Some regex assistance needed. How do I go about performing a preg_match
to extract things in between patterns? example: begin here ### lkajsdf laksjf lasjkdf lajsf kfjjfjfkj ljkasf lkja lkasj lkj lkjasdf 2lj as - end here ----- So I would like to get the contents of: begin here ### * end here ----- Thanks! Matt |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
I believe your regex would be
/begin here ###([\s\S]+?) end here -----/ Aerik |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
On Tue, 11 Sep 2007 19:21:00 -0000, Aerik <asylvan@gmail.com> wrote:
: I believe your regex would be : : /begin here ###([\s\S]+?) end here -----/ : : : Aerik : Please explain the purpose of +? placed together. As I understand it, + matches one ore more and ? matches 0 or 1. Thanks! Matt |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
> Please explain the purpose of +? placed together. As I understand it, +
> matches one ore more and ? matches 0 or 1. > > Thanks! > Matt Putting the question mark makes the plus not be greedy - google "regex greedy" for lotsa info. Best Regards, Aerik |
|
![]() |
| Outils de la discussion | |
|
|