• [yibentong 1751] solution to string sorting problem


    Title Description Given a string of lowercase letters\(S\)。 have\(m\)Operations, 3 parameters are given for each operation\(l\),\(r\),\(x\)。 If\(x=1\), will\(Sl∼Sr\)Sort in ascending order; If\(x=0\), will\(Sl∼Sr\)Sort in descending order. You need to find the final sequence. input Two integers in the first line\(n\),\(m\)。 The second line is a string\(S\)。 next\(m\)Three integers per line\(x\),\(l\),\(r\)。 output One string per line […]

  • Regularization of special requirements


    /^[a-za-z] [\ D \ sa-za-z] * $// / must start with a letter. You can only enter letters or numbers, not Chinese characters  

  • 17. Letter combination of telephone number (leetcode) – C language and JS


    1、 C language implementation /** * Note: The returned array must be malloced, assume caller calls free(). */ char *letterNumber[] = {“”, “”, “abc”, “def”, “ghi”, “jkl”, “mno”, “pqrs”, “tuv”, “wxyz”}; int len; char *digitsBak; char **res; int resSize; char *resItem; int resItemSize; void backTrack(int index) { if (index == len) { //Allocate space to […]

  • How to implement a search engine with CSS?


    Hello, I’m Carson. stayCSSIn, we passedselector(selector) select a style clip: .title { color: red; } In short, selectorstitleCorresponding stylecolor: red; From another angle, we can also say: Keywords.titleCorresponding datacolor: red; In our life, what else depends on this correspondence? An obvious example: search engine. Enter in search enginekey word, the search engine searches and returnskey […]

  • Regular expression overview


    1、 Use of regular expressions 1.1 creation of regular expressions Method 1: create by calling the constructor of regexp object var regexp = new RegExp(/123/); console.log(regexp); Method 2: create regular expressions with literal values var rg = /123/; 1.2 testing regular expressions test()The regular object method is used to detect whether the string conforms to […]

  • Learning notes of JS related knowledge (IV) — getting to know regular expressions


    1. Common scenarios for regular expressions (1) Validation forms: matching character combinations (2) Replace some keywords, such as sensitive words (3) Extract the desired character segment from the string 2. Use of regular expressions in JS (1) Create Using the constructor of regexp object var reg = new RegExp(/123/) Create with literal Var reg = […]

  • 25 JS regular expressions commonly used in front-end form validation


    1. Mobile phone number verification const phoneReg = /^[1][3,4,5,6,7,8,9][0-9]{9}$/ const phoneStr1 = ‘18886233487’ console.log(phoneReg.test(phoneStr1)) // true const phoneStr2 = ‘17283017203897’ console.log(phoneReg.test(phoneStr2)) // false 2. Verification of ID card const sfzReg = /^[1-9]\d{5}(18|19|([23]\d))\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9Xx]$/ const sfzStr1 = ‘415106199801012130’ console.log(sfzReg.test(sfzStr1)) // true const sfzStr2 = ‘718381298381212183’ console.log(sfzReg.test(sfzStr2)) // false 3. Verification of mailbox const emailReg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/ const […]

  • Command execution – bypass method with letters filtered or numbers + letters filtered


    0x00 Preface Summarize some tips for bypassing alphanumeric commands. 0x01 principle In order to prevent the execution of commands caused by malicious code entered by any user, the administrator adds a layer of WAF interception at the user input. WAF may filter letters through regular matching or letters and numbers through regular matching. 0x02 filtered […]

  • [shell] basic regular symbol


    Use the grep command to add the parameter – O to display the captured contentThere are two types of regular symbols,Basic regularityandExtended regularity: Basic regularity content ^ With Beginning $ With epilogue ^$ Empty line . Any character * The previous character appears 0 or more times in a row .* Equivalent to shell *, […]

  • Caret in JS regular^


    I Caret^1. The meaning of the character representing the beginning is as follows:/^123$/g.test(‘123’); //true 2. Use of antisense characters: for example, only Chinese, letters and numbers are matched /[^ \ u4e00 – \ u9fa5 \ w] / g.test (“mygege @) // true matches @ so it is true /[^\u4e00-\u9fa5\w]/g.test(“mygege “) //false

  • With these 25 regular expressions, the code efficiency is improved by 80%


    preface Hello, I’m Lin Sanxin. In daily development,regular expression Is very useful,regular expression It can be used in every languageJSONSame, it’s universal. In daily development, learn some commonregular expression Can greatly improve your work efficiency, for example String matching Format verification of form items Today, let’s share 25 regular expressions commonly used in development!!! I […]

  • c#_ HttpClient_ application/x-www-form-urlencoded_ Parameter escape


    Guide: only use httpclient library to simulate HTTP request and post request header Content type: application / x-www-form-urlencoded # problem of escaping when non alphanumeric characters are encountered Code:https://github.com/dswyzx/forblogsAnd result screenshot   1: Problem: due to the docking interface, the character “+” exists in the parameters, resulting in differences between the two sides when confirming […]