Yes, I am trying to delete everything except the capital letters, although in reality it does not look good.
I used the following code,
String.replace(/(?![A-Z])./, '');
It seems to work incorrectly, although it works using PHP.
Add an option globalat the end regex- see demo below:
global
regex
console.log("AkjkljKK".replace(/(?![A-Z])./g, ''));
you can use [^A-Z]to remove everything except capital letters. Also use gto replace all occurrences, not just the first one.
[^A-Z]
g
var str = "sOmeVALUE"; console.log(str.replace(/[^A-Z]/g, ""));
Source: https://habr.com/ru/post/1682874/More articles:Is this approach better than just shooting stream.Read () in Task.Run? - c #Lines Bootstrap - Make bottom line top - htmlI would like some advice on Spring Error BeanCreationException - springHashMap maintains an array, then why is it disordered - javaСортировка Наблюдение по предопределенному порядку в реактивных расширениях - sortingНеизвестная ошибка при создании собственной функции - javascriptКак понять роль очереди в распределенной системе? - distributed-systemPerformance of numpy vs pandas - pythonSplit string with multiple delimiters from an array (Python) - pythonAngular 2/4 adal-angular4 Active Directory authenticates API issue - angularAll Articles