0

Can anybody help me please. I get an url and need to take the last part after -.

Example data

  • game-when-no-one-at-xhU8c0dL
  • coins-at-the-desk-1xhz83c
  • example-example-1391340

Result needed

  • xhU8c0dL
  • 1xhz83c
  • 1391340

I just made a regex to take some last characters, but number of symbols can be 7 or 8.

preg_match('/.{7}(?=($|\r|\n))/')

Edit

This will work: preg_match('/[^-]*$/')

bobble bubble
  • 16,888
  • 3
  • 27
  • 46
Dimitrie
  • 11
  • 1

0 Answers0