Problem function dashesToParentheses(str) { var list = str.split(‘-‘); return str.replace(/-/g, ‘(‘) + repeatString(‘)’, list.length – 1); } function repeatString(str, times) […]
Category: Regex
Parsing values from string into struct using match in Julia
Problem My goal I am parsing from a string which contains token:value pairs into a type. Example: mutable struct Foo […]
Fraction or percentage regular expression
Problem I’m learning regular expression as part of my Java course. Now I know sometimes the best use of regex […]
Port of NLTK tokenizing code from Python to Rust
Problem I’m working on a port of NLTK to Rust. I am fairly new to Rust, so I wanted to […]
Validator and Sanitizer for HTML 5 attribute regex according to current HTML living standard
Problem According to https://html.spec.whatwg.org/multipage/syntax.html#attributes-2 an HTML 5 attribute name is defined like this: Attribute names must consist of one or […]
Highlight specific words in a sentence with diacritrics
Problem I am searching for some improvements, particularly in the regex, in the way I highlight specific words in a […]
Parsing annotation
Problem I have implemented code for parsing annotation: /** * @Route(path=”sample n test”,code,value,boolean,test) * @access(code=false) * @sample as asdad asd […]
Indenting and dedenting ASP Classic code with Python
Problem I’ve created a Python script that tries to properly indent and dedent ASP code. Similar to http://www.aspindent.com/ Since I’ve […]
Replace function for C++
Problem I’m learning regex for c++, and tried to make a simple function. It is very small but I’m satisfied, […]
Analyzing a web access log to obtaining totals for requests
Problem This program takes the filename as the input and outputs to a file the number of requests that were […]