List Info

Thread: Remove newlines in HTML tables, but not elsewhere...




Remove newlines in HTML tables, but not elsewhere...
country flaguser name
United States
2007-10-16 11:29:14
Hi all,

I'm not a great regex specialist so I hope I could find some
help
here.
I'm not totally new to them, but this time is far more
complicated...
I use Perl regular expressions in PHP and I can't manage how
to remove
newlines (n) in my HTML tables. Here's an example of what
I'd like to
do :

INPUT:
Once upon a time...
In Far Far Away Kingdom...
<table>
<tr>
<td>
Shrek
</td>
</tr>
</table>

OUTPUT:
Once upon a time...
In Far Far Away Kingdom...
<table><tr><td>Shrek</td></tr>
</table>


Here is what I tried (among other things), but of course,
that doesn't
work :
preg_replace('/(?<=<table>)n(?=</table>
)/', '', $sText)

Thank you in advance for your help

Alexandre


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Regex" group.
To post to this group, send email to regexgooglegroups.com
To unsubscribe from this group, send email to
regex-unsubscribegooglegroups.com
For more options, visit this group at http://groups.go
ogle.com/group/regex
-~----------~----~----~----~------~----~------~--~---


Re: Remove newlines in HTML tables, but not elsewhere...
country flaguser name
United States
2007-10-16 12:15:30
PHP generates new lines with rn.

>
preg_replace('/(?<=<table>)n(?=</table>
)/', '', $sText)

-- 
Jon Molesa
http://rjmolesa.com

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Regex" group.
To post to this group, send email to regexgooglegroups.com
To unsubscribe from this group, send email to
regex-unsubscribegooglegroups.com
For more options, visit this group at http://groups.go
ogle.com/group/regex
-~----------~----~----~----~------~----~------~--~---


Re: Remove newlines in HTML tables, but not elsewhere...
country flaguser name
United States
2007-10-17 02:34:13
> PHP generates new lines with rn.

True only if you're on MSWindows platform AND if PHP
generates the
newlines, but none applies here.


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Regex" group.
To post to this group, send email to regexgooglegroups.com
To unsubscribe from this group, send email to
regex-unsubscribegooglegroups.com
For more options, visit this group at http://groups.go
ogle.com/group/regex
-~----------~----~----~----~------~----~------~--~---


Re: Remove newlines in HTML tables, but not elsewhere...
country flaguser name
United States
2007-10-17 11:21:22
Please replace '>n' with '>'


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Regex" group.
To post to this group, send email to regexgooglegroups.com
To unsubscribe from this group, send email to
regex-unsubscribegooglegroups.com
For more options, visit this group at http://groups.go
ogle.com/group/regex
-~----------~----~----~----~------~----~------~--~---


Re: Remove newlines in HTML tables, but not elsewhere...
country flaguser name
United States
2007-10-17 11:23:28
Please replace ">n" with ">


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Regex" group.
To post to this group, send email to regexgooglegroups.com
To unsubscribe from this group, send email to
regex-unsubscribegooglegroups.com
For more options, visit this group at http://groups.go
ogle.com/group/regex
-~----------~----~----~----~------~----~------~--~---


[1-5]

about | contact  Other archives ( Real Estate discussion Medical topics )