Google Forms makes it relatively easy to add such advanced date validation rules to individual fields through Regular Expressions (or regex or regexp). Think of them as search patterns and every character entered in a form field is matched against that pattern – the form can only be submitted if the patter and the user-input matches.
Tag: REGEX
Trying to determine the best method to automatically remove HTML in all cells within a column in Google Sheets.
Example of cell data:
<span style=”color:#0000FF”>test</span>
I’d li…
=REGEXREPLACE(A1,"<[^<>]+>","")
I also found a ‘dirty’ converter code to run as a script.
However, I also found this post explaining why REGEX is not designed for parsing HTML:
Entire HTML parsing is not possible with regular expressions, since it depends on matching the opening and the closing tag which is not possible with regexps.
Regular expressions can only match regular languages but HTML is a context-free language and not a regular language (As @StefanPochmann pointed out, regular languages are also context-free, so context-free doesn’t necessarily mean not regular). The only thing you can do with regexps on HTML is heuristics but that will not work on every condition. It should be possible to present a HTML file that will be matched wrongly by any regular expression.
Enhance your data skills and learn how to use the powerful REGEX formulas in Google Sheets
Iβm on record as being a big supporter of learning regular expressions (AKA βregexpβ) β handy ways to search through text with very complex criteria. Itβs notoriously β¦
RE2 is a fast, safe, thread-friendly alternative to backtracking regular expression engines like those used in PCRE, Perl, and Python. It is a C++ library. – google/re2