Başka preg_replace ve maçlara preg_replace

0 Cevap php

Ben çok temel bir şey eksik olabilir bir his var. Heres senaryo neyse:

I'm using preg_replace to convert ===inputA===inputB=== to <a href="inputB">inputA</a>
This is what I'm using

$new = preg_replace('/===(.*?)===(.*?)===/', '<a href="$2">$1</a>', $old);

Onun çalışma cezası tamam, ama ben daha da bu yüzden onun böyle InputB kısıtlamak gerekir

preg_replace('/[^\w]/', '', every Link or inputB);

So basically, in the first code, where you see $2 over there I need to perform operations on that $2 so that it only contains \w as you can see in the second code. So the final result should be like this:
Convert ===The link===link's page=== to <a href="linkspage">The link</a>

Bu, ne yapmalıyım nasıl hiçbir fikrim yok?

0 Cevap