-
Reg Expressions
I want you use regular expressions to find 1. a new line / entered line and 2. to find a website. When using them is there a find and replace or does it write it to a varible that then would be used with the string_replace?
1. This is an example of what I'd like to find. The * indicates where I'd expect the match to occur. I've found "\n \t \r". I don't know if \n would be both of those or just the second and where \r would work. Would I put 2 in two find the second or 2\n or 2\r? I want to be able differentiate from each.
"This is the test
*this was one return.
*
This is two returns."
2. I'd assume i'd start the search with http:// then the regex for anything (forgot what that is *?) but I can't figure out how to find the end of the address like i figured I could do a long list of if's with all extensions and then domain endings with/ and a space like ".com/ " but is there any easier way?
*indicate what I'd want to find.
*http://www.google.com/*
*http://www.google.com/yeah.html*
Thanks for any suggestions you can offer.
-
-
I really didn't get any of what you said, can you please put it in to correct grammar?
Here is a manual on regexp in php. If you really need regexp - then use it, but I suggest the str*.
http://us3.php.net/manual/en/book.strings.php
-
-
OO sorry about the grammar. I'm trying to make a really simple CMS.
I want to be able to distinguish between these two differences; one being a new line, and one just being a return. For an example the paragraph below.
This is the first line
this was just a return.
This is the new line.
I want to be able to insert a <br /> between the "line" and "this". Then I want to insert a </p><p> between "return." and "This".
Then I also want to be able to find a whole address like http://www.whatevere.com/ or http://whatevere.com/this/that.html. I was thinking I could do a search for the "http://" but then I don't know what to put after or how to find the ending of it. I want to be able to make these link automatically so just "<a href="WHAT'S FOUND GOES HERE>WHAT'S FOUND GOES HERE</a>" would go in place of that "http://www.whatevere.com/" .
Hope this is clearer thanks for any ideas you can offer.
Last edited by bluewalrus; 01-11-2009 at 12:59 AM.
-
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
Bookmarks