Category:Regular Expression
-
Time:2021-3-5
Test code <script type=”text/javascript”> //1. You can only enter numbers or decimal points, only integers, integers plus decimals var reg1=/(^[0-9]{1,2}$)|(^[0-9]{1,2}[\.]{1}[0-9]{1,2}$)/; console.log (reg1. Test (“+” empty string false “); console.log(reg1.test(“1″)+” 1 true”); console.log(reg1.test(“10″)+” 10 true”); console.log(reg1.test(“10.”)+” 10. false”); console.log(reg1.test(“100″)+” 100 false”); console.log(reg1.test(“100.1″)+” 100.1 false”); console.log(reg1.test(“10.1″)+” 10.1 ture”); console.log(reg1.test(“10.10″)+” 10.10 true”); console.log(reg1.test(“10.101″)+” 10.101 false”); console.log(reg1.test(“0.101″)+” 0,101 false”); […]
-
Time:2021-3-4
At present, there are only three kinds of problems, such as titles, using regular expressions to match fields re.match() re.search() re.findall() For a brief introduction, re.match () and re.search () is very similar. The main difference is that the former matches from the beginning of the target string, while the latter does not. and re.findall […]
-
Time:2021-3-3
1. Use XPath to clean up unnecessary tag elements and no content tags from lxml import etree def xpath_clean(self, text: str, xpath_dict: dict) -> str: ”’ XPath cleans up unnecessary elements :param text: html_content :param xpath_ Dict: clear target XPath :return: string type html_content ”’ remove_by_xpath = xpath_dict if xpath_dict else dict() #Items that must […]
-
Time:2021-3-1
Any rule maintains a common set of regular expressions, and is a regular expression tool supporting web / vs Code / idea / Alfred workflow platform. install Search in vs code store“any-rule” use Mode 1: Press F1 (FN + F1 under MAC) to open the regular listEnter a keyword search, such as “mobile” Mode 2: […]
-
Time:2021-2-26
Go (also known as golang) is a static, strongly typed and compiled language developed by Robert Griesemer, rob pike and Ken Thompson of Google. The syntax of go language is similar to that of C, but its functions include: memory security, GC (garbage collection), structure and CSP style concurrent computing. Robert Griesemer, rob pike and […]
-
Time:2021-2-25
When input is used to write input, the following situations often occur: You can enter only one. Chestnut: you can only enter numbers, only letters (upper case, lower case), only a fixed format. Chestnut: you can only enter the amount, you can only enter decimals, and you can keep 2 digits at most. You can’t […]
-
Time:2021-2-24
On the matching rules of regular expression raw This is an example I got in my study. The first expression matches none. So I’m thinking about why it can’t be matched. Assuming that the “t” is escaped as a “t”, then it should be matched to “t” instead of “None”.In order to verify this problem, […]
-
Time:2021-2-23
IPv4 regular expression IPv4 addresses can be divided into five categories: ABCDE, ABC is common IP address, D is multicast address, and E is reserved for research. The ranges are as follows A: 1.0.0.1-126.155.255.255 Intranet address range: 10.0.0.0-10-255.255.255 B: 127.0.0.1 —191.255.255.255 Intranet address range: 172.16.0.0-172.31.255.255 C: 192.0.0.1 —223.255.255.255 Intranet address range: 192.168.0.0-192.168.255.255 D: 224.0.0.1 —239.255.255.255 […]
-
Time:2021-2-22
In fact, the front-end and back-end need to convert the markdown text into HTML text, and there is a corresponding library. A few sentences of code are OK, but sometimes we have to obtain a tag in the markdown to carry out the corresponding conversion. There are several methods, which can be obtained from the […]
-
Time:2021-2-21
The front end transfers parameters and calls the interface Pass the two values to the back end for comparison, and modify the value of another field in the data table if the conditions are met init (id) { this.dataForm.id = id || 0 this.visible = true this.$nextTick(() => { this.$refs[‘dataForm’].resetFields() if (this.dataForm.id) { this.$http({ url: […]
-
Time:2021-2-20
Introduction to regular expressions Regular expression, also known as regular expression. Regular expression, often abbreviated as regex, regexp or re in code, is a concept of computer science. Regular expressions are usually used to retrieve and replace text that conforms to a certain pattern (rule). Many programming languages support string manipulation using regular expressions. For […]
-
Time:2021-2-17
Regular expression of JS / / check whether it is composed of all numbers function isDigit (s) {var PATRN = / ^ [0-9] {1,20} $/; if (! patrn.exec (s) ) return false return true} / / verify login name: you can only enter 5-20 login names that start with a letter, can carry a number, […]