Olmayan herhangi bir karakter veya sayı karşı bir düzenli ifade eşleşmesi

0 Cevap php

Ok, here again. I'll promise to study deeply the regular expression soon :P

Dil: PhP

Problem: Match if some badword exist inside a string and do something. The word must be not included inside a "greater word". I mean if i'll search for "rob" (sorry Rob, i'm not thinking you're a badword), the word "problem have to pass without check.

Etrafa googled ama benim için iyi bir şey bulmuştu. Yani, böyle bir şey düşündüm:

I sonra aşağıdakilerden herhangi bir karakter önce birlikte kelime maç ise:

  • .
  • ,
  • ;
  • :
  • !
  • ?
  • (
  • )
  • +
  • -
  • [whitespace]

Ben bir dizge içinde tek bir kelime karşı bir çek taklit edebilirsiniz.

Nihayet Sorular:

  1. There's a better way to do it?
  2. If not, which will be the correct regexp to consider [all_that_char]word[all_that_char]?

Thanks in advance to anyone would help! Maybe this is a very stupid question but today is one of that day when move our neurons causes an incredible headache :|

0 Cevap