How to use regex_substr in QGIS to extract text before a /?

المشرف العام

Administrator
طاقم الإدارة
I have a database of motorway junctions which are named like this:

  • M90 J8/A91/B996
  • M90 J1/A90/A921/A985(T)
  • M9 J1A
There is significant variability in the length of the strings but they all follow the same basic pattern of Motorway ID Junction Number / Link Road IDs

I need to extract everything before the first forwardslash i.e. the Motorway ID and Junction Number.

I've been trying to use regex_substr based on other answers on here like this: regexp_substr( "NAME", '^(.+)/') but this extracts everything before the last forwardslash. How can I alter it to get the text before the first slash?



أكثر...
 
أعلى