PDA

View Full Version : Regula Expression


texerasmo
29-10-2007, 16:01
Ciao tutti dovrei fare un regual expression .
i parametri sono questi

String testjava="throw new SQLErrorException(\"broker.getDbController().getContext() fallito\") ";


le mie condizioni sono

La parola Exception seguita da ("
e che la stringa finisce");

come posso fare?

String patternStr = "[A-Za-z]+Exception[(\"]+[A-Z0-9._%+-]$[\")]";

amedeoviscido
30-10-2007, 16:35
Non mi ricordo un granché, però ti consiglio questo sito:

http://www.fileformat.info/tool/regex.htm

Che ti permette di testare le regex al volo.

Ziosilvio
30-10-2007, 16:58
C'è anche QUESTO SITO (http://www.regular-expressions.info/) che puoi consultare.
Se preferisci il formato cartaceo, Jeffrey Friedl ha scritto un ottimo testo, pubblicato da O'Reilly e ormai arrivato alla terza edizione, nella quale vengono trattate anche le regex Java.