Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

mal wieder ein regulärer Ausdruck...

Empfohlene Antworten

Veröffentlicht

Hallo!

Hab mal wieder ein kleines problem mit nem regulären ausdruck:

Ich durchsuche eine Datei mit Hilfe eines regulären Ausdrucks, möchte jedoch mit diesem Ausdruck gleichzeitig einen Teil des Ergebnisses gespeichert, bzw. zurück gegeben bekommen!

Normalerweise geht das in dem man den Teil den man sich merken möchte in Klammern setzt und später kann man dann mit &1, &2, &3 ... darauf zugreifen.

Nun ist es so, dass ich meinen Ausdruck in einem String vorher speichere und ihn später an eine Methode übergebe:


private String myPerl5RegExp = "*suite.addTest*";

private Perl5Util myPerl5Util = new Perl5Util();


...


File theFile = new File(aFilename);


BufferedReader in = new BufferedReader(new FileReader(theFile));

char[] theContents = new char[(int) theFile.length()];

in.read(theContents);

if(myPerl5Util.match(aPerl5RegExp, theContents)) {

    ....    

}


Die Methode match() gibt nur nen boolean zurück und ich habe in der API von Apache Oro nichts weiter gefunden, das dem Problem nur ansatzweise näher kommt!

Vielleicht wisst ihr ja was...

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.