Frage

So I've got this piece of code that wont play nice.

preg_match_all("/(\{\[)([\w-\d\s\.\|']*)(\]\})/i",$replace_text, $match);

What it is supposed to do, is allow an apostrophe to be in my replacement text. So in my text, where i have "{[SPIN--they are|they’re]}" it should return "they are" or "they're". But instead, it simply does nothing and spits out the entire spintax code just as I typed above.

The only time this does not work, is when a replacement text has an apostrophe. It works perfectly everywhere else. Been trying to fix this for two days and I'm about to throw my keyboard through my monitor.

There are many things that my project does and it is imperative to have the {[SPIN-- before specifying the replacement text, and the ]} closing brackets.

Can someone help, please?

War es hilfreich?

Lösung

In your example string it's not a single quote character, but something that looks similarly

(the actual character) vs ' (that's what you think it is)

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top