Hi,
I'm using regex in our project. How can I check 2 strings in a sentence?
For example like below, if a sentence has "is" and "sentence" words, I want to choose it.
"this is a test sentence"
How can I do this?
regards.
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Iftikar HussainPosted Jul 26, 2013, 4:46 AM
Regards,
Iftikar
Iftikar HussainPosted Jul 26, 2013, 4:43 AM
now you have asking different expression.
Regards,
Iftikar
VulpesPosted Jul 26, 2013, 4:28 AM
yokzuPosted Jul 26, 2013, 3:51 AM
I tryed your code too but it didnt work.
Sorry maybe I write the wrong example.
"ABCD-5-DCEG: Process 111, Nbr 1.1.1.1 on from FULL to DOWN, Neighbor Down:"
The example is like above.
I want to choose if starts with "ABCD-5-DCEG:" and contain "DOWN" words.
Sunny SharmaPosted Jul 26, 2013, 3:42 AM
read it like this:
(\bWORD1\b)(?:[^.]|\.\s)*(\bWORD2\b)
It will work, tested solution.
Iftikar HussainPosted Jul 26, 2013, 3:38 AM
Regards,
Iftikar
yokzuPosted Jul 26, 2013, 3:37 AM
It doesnt work:/
Iftikar HussainPosted Jul 26, 2013, 3:28 AM
Try like this
Regards,
Iftikar
Sunny SharmaPosted Jul 26, 2013, 3:18 AM
use this regex:
(\bis\b)(?:[^.]|\.\s)*(\bsentence\b)
Happy Coding :)
Cheers!
yokzuPosted Jul 26, 2013, 3:17 AM
^(this).\btest\b