-1

can someone please quickly help me with regularexpression to match any character and group it which is coming behind front shash:

ae-app001/UK/Server/company

in this i want to match ae-app001 only.

the format remains the same except that we dont know how many slash might be there, sometimes the string might be just :

ae-app001/UK/Server

so i need a generic regex which will match string1 in the below:

string1/string2/string3/string4 
string1/string2/string3 

etc..

Gurmanjot Singh
  • 10,224
  • 2
  • 19
  • 43
kaushik km
  • 39
  • 8

1 Answers1

0

/^([^\/]+)/ Demo

But what if there's no slashes? Is it ok to capture whole string?

Alex Python
  • 329
  • 1
  • 8