How to search in strings

I want to search for the text "geograf" in Java strings. Following
occurences should be found
"geograf"
"blabla geograf blabla"
"GEOgraf"
but not
// "geograf"
/* geograf */
dcs.geograf.GeografLibrary

Thanks in advance for your help.

Tom

0
10 comments
Avatar
Permanently deleted user

Hi,

Structural Search: "$a$", a.text="geograf", whole words only
Please, note that case sensitive option = true will be much-much faster.


Thomas Singer (MoTJ) wrote:

I want to search for the text "geograf" in Java strings. Following
occurences should be found
"geograf"
"blabla geograf blabla"
"GEOgraf"
but not
// "geograf"
/* geograf */
dcs.geograf.GeografLibrary

Thanks in advance for your help.

Tom



--
Best regards,
Maxim Mossienko
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

0
Avatar
Permanently deleted user

Structural Search: "$a$", a.text="geograf", whole words only
Please, note that case sensitive option = true will be much-much faster.


Seems not to work, it just finds "geograf", but not " geograf ".

Tom

0
Avatar
Permanently deleted user

Correction: with "Whole Words Only" option checked, it seems to work.
But this is strange, because "Whole Words Only" suggests to be a filter,
which might reduce the found occurences, not to find more than without it.

Tom

0
Avatar
Permanently deleted user

BTW, how to search for "..." instead of "geograf" (conditions the same)?

Tom

0
Avatar
Permanently deleted user

text = .\.\.\.., whole words only=false

Thomas Singer (MoTJ) wrote:

BTW, how to search for "..." instead of "geograf" (conditions the same)?

Tom



--
Best regards,
Maxim Mossienko
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

0
Avatar
Permanently deleted user

Yes, the option set is shorthand for complex reg exp around the text
constraint .*
b(?:)
b
Yet another presentation of the option could be 2 radio buttons like:
'match the text' and 'match the text on the word boundary'

Thomas Singer (MoTJ) wrote:

Correction: with "Whole Words Only" option checked, it seems to work.
But this is strange, because "Whole Words Only" suggests to be a filter,
which might reduce the found occurences, not to find more than without it.

Tom



--
Best regards,
Maxim Mossienko
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

0
Avatar
Permanently deleted user

Yet another presentation of the option could be 2 radio buttons like:
'match the text' and 'match the text on the word boundary'


To be honest, this would not help me further, because "word boundary" is
unclear to me.

Tom

0
Avatar
Permanently deleted user

Ahm, do you think, this is intuitive? Why not have the possibility to
either enter plain text or regular expression text? Why not add a menu
button right beside the regular expression text input field for easy
entering such strange regular expressions (BTW, this was requested ages
ago)?

Tom

0
Avatar
Permanently deleted user

The text of the constraint is actually whole words in larger construction.

Thomas Singer (MoTJ) wrote:
>> Yet another presentation of the option could be 2 radio buttons like:
>> 'match the text' and 'match the text on the word boundary'


To be honest, this would not help me further, because "word boundary" is
unclear to me.

Tom



--
Best regards,
Maxim Mossienko
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

0
Avatar
Permanently deleted user

Hi,

Most of used text fragments (as of my information) are plain english
words so there were no difference at all for the user.
However, adding checkbox (two, actually, since there are two such
fields) on how to treat the content of the field will be usable in some
(rare?) cases.

Thomas Singer (MoTJ) wrote:

Ahm, do you think, this is intuitive? Why not have the possibility to
either enter plain text or regular expression text? Why not add a menu
button right beside the regular expression text input field for easy
entering such strange regular expressions (BTW, this was requested ages
ago)?

Tom



--
Best regards,
Maxim Mossienko
IntelliJ Labs / JetBrains Inc.
http://www.intellij.com
"Develop with pleasure!"

0

Please sign in to leave a comment.