Doubt regex use information after "_"

Asked

Viewed 31 times

-2

I got the string:

NeName  =  MGLUE_EPCVMH_UGW01

I need the first three letters after the first "_" Can you help me?

  • 3

    In some specific language?

1 answer

2

The regular expression is as follows:

_(.{3})

Here’s a Javascript test that shows you how it works:

var str = 'NeName = MGLUE_EPCVMH_UGW01';
var regex = /_(.{3})/m;
var match = regex.exec(str);
console.log(match[1]);

Browser other questions tagged

You are not signed in. Login or sign up in order to post.