Skip to main content
deleted 228 characters in body; edited tags
Source Link
Dharman
  • 34k
  • 27
  • 105
  • 156

Assuming I have a sting which is "a s d d" and htmlentities turns it into
"a s d d".

How to replace (using preg_replacepreg_replace) it without encoding it to entities?

I tried preg_replace('/[\xa0]/', '', $string);, but it's not working. I'm trying toit didn't remove those specialthe characters from my string as I don't need them.

What are the possibilities beyond regexpregular expression?

Edit String I want to parse: http://pastebin.com/raw/7eNT9sZr
with function preg_replace('/[\r\n]+/', "[##]", $text)
for later implode("</p><p>", explode("[##]", $text))

My question is not exactly "how" to do this (since I could encode entities, remove entities iI don't need and decode entities). But how to remove those with just str_replacestr_replace or preg_replacepreg_replace.

Assuming I have a sting which is "a s d d" and htmlentities turns it into
"a&nbsp;s&nbsp;d&nbsp;d".

How to replace (using preg_replace) it without encoding it to entities?

I tried preg_replace('/[\xa0]/', '', $string);, but it's not working. I'm trying to remove those special characters from my string as I don't need them

What are possibilities beyond regexp?

Edit String I want to parse: http://pastebin.com/raw/7eNT9sZr
with function preg_replace('/[\r\n]+/', "[##]", $text)
for later implode("</p><p>", explode("[##]", $text))

My question is not exactly "how" to do this (since I could encode entities, remove entities i don't need and decode entities). But how to remove those with just str_replace or preg_replace.

Assuming I have a sting which is "a s d d" and htmlentities turns it into
"a&nbsp;s&nbsp;d&nbsp;d".

How to replace (using preg_replace) it without encoding it to entities?

I tried preg_replace('/[\xa0]/', '', $string);, but it didn't remove the characters.

What are the possibilities beyond regular expression?

My question is not exactly "how" to do this (since I could encode entities, remove entities I don't need and decode entities). But how to remove those with just str_replace or preg_replace.

added 377 characters in body
Source Link
Grzegorz
  • 3.6k
  • 4
  • 31
  • 48

Assuming I have a sting which is "a s d d" and htmlentities turns it into
"a&nbsp;s&nbsp;d&nbsp;d".

How to replace (using preg_replace) it without encoding it to entities?

I tried preg_replace('/[\xa0]/', '', $string);, but it's not working. I'm trying to remove those special characters from my string as I don't need them

What are possibilities beyond regexp?

Edit String I want to parse: http://pastebin.com/raw/7eNT9sZr
with function preg_replace('/[\r\n]+/', "[##]", $text)
for later implode("</p><p>", explode("[##]", $text))

My question is not exactly "how" to do this (since I could encode entities, remove entities i don't need and decode entities). But how to remove those with just str_replace or preg_replace.

Assuming I have a sting which is "a s d d" and htmlentities turns it into
"a&nbsp;s&nbsp;d&nbsp;d".

How to replace (using preg_replace) it without encoding it to entities?

I tried preg_replace('/[\xa0]/', '', $string);, but it's not working. I'm trying to remove those special characters from my string as I don't need them

What are possibilities beyond regexp?

Assuming I have a sting which is "a s d d" and htmlentities turns it into
"a&nbsp;s&nbsp;d&nbsp;d".

How to replace (using preg_replace) it without encoding it to entities?

I tried preg_replace('/[\xa0]/', '', $string);, but it's not working. I'm trying to remove those special characters from my string as I don't need them

What are possibilities beyond regexp?

Edit String I want to parse: http://pastebin.com/raw/7eNT9sZr
with function preg_replace('/[\r\n]+/', "[##]", $text)
for later implode("</p><p>", explode("[##]", $text))

My question is not exactly "how" to do this (since I could encode entities, remove entities i don't need and decode entities). But how to remove those with just str_replace or preg_replace.

Source Link
Grzegorz
  • 3.6k
  • 4
  • 31
  • 48

How to replace decoded Non-breakable space (nbsp)

Assuming I have a sting which is "a s d d" and htmlentities turns it into
"a&nbsp;s&nbsp;d&nbsp;d".

How to replace (using preg_replace) it without encoding it to entities?

I tried preg_replace('/[\xa0]/', '', $string);, but it's not working. I'm trying to remove those special characters from my string as I don't need them

What are possibilities beyond regexp?