Skip to main content
Solved

How to filter string by using a word, not part of string

  • June 30, 2022
  • 4 replies
  • 95 views

smfks911

Hi there, can anyone please help me how can I filter some record that have a particular word. For example, I would like to filter all the road name starts with 'The ' (e.g. The Meadow but not like 'Theodor road'. If I use contains/begins with in the tester, it gives me all that have string part 'The'. I never used Regex editor. A good response will be highly appreciated. Thanks in advance.

Best answer by birgit

The tester really should work for this. You need to use the begins with option on the tester and the test clause should be "The " (with a space behind it). That way you will only get The Meadow and not Theodor road.

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

4 replies

birgit
Influencer
Forum|alt.badge.img+21
  • Influencer
  • 131 replies
  • Best Answer
  • June 30, 2022

The tester really should work for this. You need to use the begins with option on the tester and the test clause should be "The " (with a space behind it). That way you will only get The Meadow and not Theodor road.


smfks911
  • Author
  • 46 replies
  • June 30, 2022

The tester really should work for this. You need to use the begins with option on the tester and the test clause should be "The " (with a space behind it). That way you will only get The Meadow and not Theodor road.

Thank you very much for @birgit​ for showing the catch :)


hkingsbury
Celebrity
Forum|alt.badge.img+63
  • Celebrity
  • 1620 replies
  • June 30, 2022

There are some cases where the "begins with" option will miss valid strings. You can use the regex:

(^| )the($| )

The code above is saying, find the string 'the' where it is preceeded by a space or its the start of the line and where its followed by a space or the end of the line

 

https://rubular.com/r/jKibYVEqV7Z5QY


smfks911
  • Author
  • 46 replies
  • June 30, 2022

There are some cases where the "begins with" option will miss valid strings. You can use the regex:

(^| )the($| )

The code above is saying, find the string 'the' where it is preceeded by a space or its the start of the line and where its followed by a space or the end of the line

 

https://rubular.com/r/jKibYVEqV7Z5QY

Thanks a lot @hkingsbury​. For me, its worked same as like Begins with as suggested in the first comment. Much appreciated!