This is a discussion on "whitespace" within the PHP Forum section. This forum, and the thread "whitespace are both part of the Program Your Website category.
|
|
|
|
|
![]() |
||
whitespace
|
||
| Notices |
![]() |
|
|
LinkBack | Thread Tools |
|
||||
|
whitespace
what was that function to take whitespace out of a string? cheers
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
|
|
|
|
|||
|
Re: whitespace
You can use trim to get rid of whitespace at the begining and end of a string
HTH |
|
||||
|
Re: whitespace
Or preg_replace:
Last Blog Entry: 10 Reasons Why My Laptop Is Better Than Your Girlfriend (Dec 15th, 2007)
|
|
||||
|
Re: whitespace
just what I needed thanks
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
|
|
||||
|
Re: whitespace
how would i do the following:
$string = str_replace('<script HERE >', '<b>BLOCKED CODE</B>', $string); how can i change HERE to a wildcard, so the following would be replaced: <script> <script src="mal.js"> <script type="text/javascript"> thanks
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
|
|
||||
|
Re: whitespace
Haven't tested this but it should work:
Last Blog Entry: 10 Reasons Why My Laptop Is Better Than Your Girlfriend (Dec 15th, 2007)
|
|
||||
|
Re: whitespace
it didn't work
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
|
|
|||
|
Re: whitespace
use .*? rather that [.]* ... and take out the leading space ahead of the [.] too if you want it to work on <script> alone.
The match you have in the example in previous posts is a greedy one that will match up to the last >; you want a sparse match to only go as far as the next >. |
|
||||
|
Re: whitespace
okay this is my function for anyone who wanted to know
to
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
|
|
||||
|
Re: whitespace
Here's a regex to check if a string is a valid PHP variable. See if you can modify this to work:
Start here: http://www.regularexpressions.info
Last Blog Entry: 10 Reasons Why My Laptop Is Better Than Your Girlfriend (Dec 15th, 2007)
|
|
||||
|
Re: whitespace
thanks i googled about and i didn't find much
+ rep for both
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
|
|
||||
|
Re: whitespace
edited my post above.
Last Blog Entry: 10 Reasons Why My Laptop Is Better Than Your Girlfriend (Dec 15th, 2007)
|
![]() |
| Thread Tools | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| removing whitespace | dudester123 | Web Page Design | 3 | Sep 1st, 2006 14:23 |
| Making an image a link adds whitespace I can't get rid of | sgware | Web Page Design | 5 | Aug 18th, 2006 22:38 |
| Meta tags causing random whitespace in IE? | Tino | Web Page Design | 4 | Aug 7th, 2006 20:32 |
| store whitespace but not interpret it in <br> | ktsirig | PHP Forum | 2 | Apr 13th, 2006 18:46 |
| Preserve Whitespace in DOM Object Problem | ivan | Other Programming Languages | 0 | Jan 27th, 2006 08:28 |