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.

Wieder mal reguläre Ausdrücke

Empfohlene Antworten

Veröffentlicht

Hallo zusammen,

ich hab ein Problem mit regulären Ausdrücken. Ich möchte den Benutzer in meinem PHP Script die Möglichkeit geben Dateifilter einzugeben (Also z.B. A*.pdf). Wenn ich das als regulaären Ausruck in ereg eintrage bekomme ich einen Fehler. Wie kann ich das durch ein Scrip automatisch in eine richtige Form bringen lassen, die als gültiger reg. Ausdruck durchgeht??

wie ist dein aktuelles script?

minimum die "/meinAusruck/" müsstest du aussen anklemmen

ich dachte das brauch ich bei ereg nicht!???

Habs jetzt so gemeacht:

$regexFilter = str_replace(".", "\.", $strFilter);

$regexFilter = str_replace("*", ".*", $regexFilter);

scheint zu funktionieren

siehe Manual:

Description

bool ereg ( string pattern, string string [, array regs])

Note: preg_match(), which uses a Perl-compatible regular expression syntax, is often a faster alternative to ereg().

Habs jetzt so gemeacht:

$regexFilter = str_replace(".", "\.", $strFilter);

$regexFilter = str_replace("*", ".*", $regexFilter);

scheint zu funktionieren

Der zweite Filter sollte so lauten:

$regexFilter = str_replace("*", ".*?", $regexFilter);

da sonst der RegEx "gierig" ist.

preg_quote() könnte evtl. hilfreich sein, wenn ich dein Problem richtig verstanden habe.

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.