Status
Not open for further replies.

skinner

Active Member
741
2010
59
5,170
Hi,

I'm trying to make a function that find a specif word in a string.

For example:

I need to find WORD

string could be:

- Find this word in this string

or

- Find.this.word.in.this.string

or

-Find-this-word-in-this-string

find 1 text with regex is simple:

Code:
\bword\b

I have problem to find word in the other two example.

Also, how can I return in fuction that I found that string?

Thanks
 
4 comments
\b is a word boundary, meaning the start or end of a line (^|$), or the point at which a sequence of word characters reaches a non-word character (e.g. "x.").

Your pattern works fine for all 3 examples you mentioned. Whats the problem?
 
\b is a word boundary, meaning the start or end of a line (^|$), or the point at which a sequence of word characters reaches a non-word character (e.g. "x.").

Your pattern works fine for all 3 examples you mentioned. Whats the problem?

Yes, it works.

The problem is that I found that I need to find WORD also in this example:

- findthisworldinthisstring

and \bword\b it seems that doesn't work..
 
Status
Not open for further replies.
Back
Top