Einzelnen Beitrag anzeigen

Benutzerbild von Jonas Shinaniganz
Jonas Shinaniganz

Registriert seit: 30. Aug 2011
249 Beiträge
 
Delphi XE5 Ultimate
 
#23

AW: Suchbegriff als "ganzes Wort" innerhalb eines Textes suchen

  Alt 22. Jun 2013, 14:23
Als Idee, wieso keine regulären Ausdrücke verwenden?

http://delphi.about.com/gi/o.htm?zi=...fo/delphi.html

The TMatch record provides several properties with details about the match.
Value returns the matched string. Index and Length indicate the position in the input string and the length of the match.

The Matches method takes a string and returns a TMatchCollection record. The default Item[] property of this record holds a TMatch for each match the regular expression found in the string. If there are no matches, the Count property of the returned TMatchCollection record is zero.

Das hier gibt dir alle "hallo" auf die ein Leerzeichen vorrangeht und folgt.
Matches(' hallo '); -
Das hier gibt dir alle "hallo" auf die ein Leerzeichen ein Punkt ein Fragezeichen oder ein Ausrufezeichen folgt oder garnichts von allem (also EOL)
Matches(' hallo[ ,/./?/!]?');
Die Leiter der Entwicklungsabteilung dreht total am Mausrad!

Geändert von Jonas Shinaniganz (23. Jun 2013 um 03:41 Uhr)
  Mit Zitat antworten Zitat