Hello! The regexp to match only 2 occurences of ';' would be:
regexp '^[^;]*;[^;]*;[^;]*$' to find the number of ';' I only have an idea for something complicated: length(<your str>) - length(replace(<your str>,';','')) StephanieTan wrote: >Hi all, >I am looking for a way to count the number of a character occurrences in a >string with MySQL. For example, I have this string "1;333;72227;00;19;1;1;" >and I would like to return the number of ";" found in this string. Is this >possible? >Also, I wanted to return fields that contain EXACTLY 2 ";" in the string, >but with LIKE or REGEXP, it returned everything that has 2 or more ";" >occurrences. Does anybody have a way to return the exact match? > >Thanks, >Stephanie > > >--------------------------------------------------------------------- >Before posting, please check: > http://www.mysql.com/manual.php (the manual) > http://lists.mysql.com/ (the list archive) > >To request this thread, e-mail <[EMAIL PROTECTED]> >To unsubscribe, e-mail <[EMAIL PROTECTED]> >Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php > > > -- Ralf Narozny SPLENDID Internet GmbH & Co KG Skandinaviendamm 212, 24109 Kiel, Germany fon: +49 431 660 97 0, fax: +49 431 660 97 20 mailto:[EMAIL PROTECTED], http://www.splendid.de --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php