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.

Regex Problem

Empfohlene Antworten

Hi Leute,

ich check es einfach nicht :)

ich möchte über eine Zeile hinweg einen wert finden und den in einem array speichern.

Mein Problem, gebe ich das array aus, ist es leer, also stimmt irgendwas mit meinem regex nicht.

Die zeile:

preg_match_all("!</td>\n\n...*!",$content,$ergebnisse);
soll das hier einlesen:
</td>


  <td class=s width=150 bgcolor="#d0ffd0">Ja</td>

denke das irgendwas am code nicht stimmt?!

Bitte doch um Hilfe :)

Vielen Dank im vorraus.

bzw. wäre es denn auch gleich möglich das man sinngemäß folgendes in das regex einbaut.

Wenn regex den wert d0ffd0 in der rückgabe findet dann ergebnis -> "ja" in den array schreiben, wenn nicht vorhanden -> "nein", reinschreiebn.

sollte ja mit | funktion gehen...allerdings hab ich von so komplexen regex noch keine ahnung, gegoogelt hatte ich jetzt schon stunden und einiges probiert, hilft aber alles nix, drum frag ich jetzt mal :)

Vielen Dank im voraus.

Bearbeitet von battleck
ausbessern :)

Also die RegEx </td>\n\n.* funktioniert bei mir und findet den Beispielstring von dir. Warum du da so viele Punkte drin hast versteh ich aber nicht.

Und dein zweites Problem, da solltest du lieber stripos (o.ä.) verwenden, weil es viel performanter als eine RegEx ist:


if (stripos($string, "d0ffd0") !== false) {
echo "d0ffd0 gefunden!";
}
[/php]

PHP: stripos - Manual

P.S. die 2= sind kein Tippfehler!

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.