❔ Regex to find string between _ or next uppercase letter

Can you help me with regex?
Roads_RoadNode
Roads_Road_261Node
Roads_Curb_91Node
Roads_CurbNode
Roads_Marking_123Node
Roads_MarkingNode
Roads_RoadNode
Roads_Road_261Node
Roads_Curb_91Node
Roads_CurbNode
Roads_Marking_123Node
Roads_MarkingNode
I need to capture these:
Road
Road
Curb
Curb
Marking
Marking
Road
Road
Curb
Curb
Marking
Marking
This regex works only for strings between underscore, but I need to support also other cases. Roads_(.*)_.* Don't have any idea how to fix it. :/
4 Replies
Angius
Angius2y ago
Roads_(.+)(_|A-Z).+ something like this? Maybe Roads_(.+)[_A-Z].+ Check Regex101 and play around with it a little
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Ice_trooper
Ice_trooperOP2y ago
/close
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.
Want results from more Discord servers?
Add your server