find the underscore through the regular expression, return the previous content, and don"t want anything else.
find the underscore through the regular expression, return the previous content, and don"t want anything else.
const reg = /([^_]*)_/g;
const str = "asdfasfdasdf safdas09-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp@asdfasdfasdfasdf_~@-sharp-sharp~~!~!";
const result = str.match(reg); // ["asdfasfdasdf safdas09-sharp-sharp-sharp-sharp-sharp-sharp-sharp-sharp@asdfasdfasdfasdf_"]
Previous: On the problem of String object in java
Next: Which class in java can read and write files at the same time?
1. The string str= "zz=aaa,bb=bbb,cc=ccc;User=ZZZ&zz=aaa1&bb=bbb1&cc=ccc1 " 2. To implement, for example, I pass in the parameter zz, and find the value of aaa1 in the zz=aaa1 after User=ZZZ. How to write the corresponding rule? ...
^ (18 [0-9] {9}) | (15 [0-9] {9}) $ Why the rule matches 1844444444444444 . My understanding of this rule is starting with 18 or 15 followed by 9 digits 0-9 . Note: I know there are other ways to write the rules of mobile phone numbers. I just ...
The range of characters is text, letters, numbers and "( ", ") ", "[ ", "] ", "space "; how should the rule of up to 20 words be written ...
need to match: https: www.example.com https: www.example.com demo https: www.example.com demo abc https: www.example.com demo abc 123.html () mismatch: https: www.example.com demo abc efg123.html ...
1. The string in the cookie fetched by the foreground is a connection of multiple cookie, for example, these two types: var str = "OnlineCookie=OnlineCookie&UserType=11111111111111111&UID=39&UserName=; UID=; UserType=; UserName=";...
MEDU1778421 FEJ7296886 FCIU2741867 FEJ7296887 GLDU9472098 FEJ7296888 I want to match the following numbers and replace them with spaces for example, how to match letters and spaces MEDU1778421 FCIU2741867 GLDU9472098 ...
as shown in the figure: I use str.replace ( (null) , "jsonCallBack "); can only replace the first null, , but what should I do to replace the third? the following is the string "< input type= " radio "name= " p_date_type_sl_sl_sl "value= " i...
var newsname; ctrl.checkNameLegal = function () { if (ctrl.fileName) { var exports = ^(?![.])[ u4e00- u9fa5_.a-zA-Z0-9]+$ ig; if (exports.test(ctrl.fileName)) { newsname = ctrl.fileName; } else { ctrl.fileName = newsname; } } else { newsname = ...
when trying to use regular matching 12-128, it is found that it can match to 129, such as the question. 192.168.0.(12[0-8]|1[0-1][0-9]|[2-9][0-9]|1[2-9]) True is returned when matches 129. judgment 255 will also match the first two digits 25. h...
1. Requirements: write a regular 2 that can automatically add a space for every 4 digits written. Problem: the regular (or incorrect) is written out, but the spaces cannot be deleted! 3. Picture 4. Code innput listening: `$("ul.information-...
const datas =[ "https: img.codeshelper.com upload img 2021 03 09 1tcsu5c0vun5800.png", "https: img.codeshelper.com upload img 2021 03 09 mc3p5hxjed25801.png", "https: img.codeshelper.com upload img 2021 03 09 b0sxs...
*start* import aaa ; *end* let a={ b: c *start* d: e *end* } now you want to match all the content from * start* to * end* , and replace it with ", , that is, all that s left in the above code is: . let a={ b:...
A HTML in a text box contains text and img tags for example <img src=".. .. static images express 4.gif" alt="[em_4]"><img src=".. .. static images express 4.gif" alt="[em_4]"> make Filter look like...
the following regular expression can successfully configure key, (^ |) in url. Doesn t it mean start or empty? how can it match & what s wrong with it? regular ?ie=utf-8&f=8&rsv_bp=0&rsv_idx=1&tn=baidu&wd=%E6%AD%A3%E5%88%99%E8%A1...
as shown in the figure above: in the first way, the $3.23 is identified as false , but in the second way, only one parameter g is removed and passed. According to principle, the first one should also be passed, please give us guidance! ...
example: (999 < video > < video > ) I want to delete the p tag in parentheses (). ...
password requires 1, number 2, letter 3, number + letter ...
Code first: if( ( module (?:.+[^ .html])) .test(". src module comment details.html")){ console.log(RegExp.$1) module comment details } if( ( module (?:.+[^ .js])) .test(". src module comment details.js")){ console...
for example: abdsdsdfsdf1526614206112164350fskdfskdf1526614199681037404bcmvbcvbmcnvz: match 1526614206112164350 and 1526614199681037404 in the string, add quotation marks on both sides, and process it as follows: abdsdsdfsdf "1526614206112164350 " fskdf...
The string.split (RegExp) method uses regular expressions to separate strings. An error occurs when the regular expression contains parentheses (), but the value returned through string.match (RegExp) is that I want the correct for example . var str = ...