Issue on javascript regex matching with match function [duplicate]

Question!

'C12345678'.match("^C\d{8}$") and

'C12345678'.match("^C\[0-9]{8}$")

Why does this statement has different values?



Answers

Because in the first case you need to escape the backslash:

   console.log('C12345678'.match("^C\\d{8}$"));

Edit

As pointed out by Wiktor in the comment below, it's best to use the Regex literal syntax:

    console.log('C12345678'.match(/^C\d{8}$/));

By : w0lf


in the final html output ui-select and ui-select-match will be generated as classes. so use the below code to get the desire output.

.ui-select {
  width: 100px;
}

.ui-select-match {
  width: 100px;
}

Here is the Plunker code.



Isn't

Content.list(max: 2, sort: "dateCreated", order: "desc")

a possibility?

By : susi


This video can help you solving your question :)
By: admin