re2

How can I normalize / asciify Unicode characters in Google Sheets?

拈花ヽ惹草 提交于 2019-12-03 07:32:27
I'm trying to write a formula for Google Sheets which will convert Unicode characters with diacritics to their plain ASCII equivalents. I see that Google uses RE2 in its "REGEXREPLACE" function. And I see that RE2 offers Unicode character classes . I tried to write a formula (similar to this one ): REGEXREPLACE("público","(\pL)\pM*","$1") But Sheets produces the following error: Function REGEXREPLACE parameter 2 value "\pL" is not a valid regular expression. I suppose I could write a formula consisting of a long set of nested SUBSTITUTE functions ( Like this one ), but that seems pretty awful.

Is it possible to use re2 from Python?

Deadly 提交于 2019-12-03 04:39:28
i just discovered http://code.google.com/p/re2 , a promising library that uses a long-neglected way ( Thompson NFA ) to implement a regular expression engine that can be orders of magnitudes faster than the available engines of awk, Perl, or Python. so i downloaded the code and did the usual sudo make install thing. however, that action had seemingly done little more than adding /usr/local/include/re2/re2.h to my system. there seemed to be some ``` .a file in addition, but then what is it with this .a`` extension? i would like to use re2 from Python (preferrably Python 3.1) and was excited to

Negate match for word in the beginning of string in RE2 syntax?

ぐ巨炮叔叔 提交于 2019-12-02 05:37:46
问题 Let's say that I have following strings: mail to tel:+358123456 http://www.google.fi mailto:foo@bar.fi hello world telephone elephant penny link owl How can I find only strings that do not start with 'tel:', 'http://' and 'mailto:' in RE2 syntax? I've tried following with following syntax, but it filters out all of them: [^(https?://|tel:|mailto:)] edit: RE2 syntax does not support negative lookbehind/lookahead. 回答1: There is no drop-in workaround for the lack of negative lookbehind on RE2

Negate match for word in the beginning of string in RE2 syntax?

女生的网名这么多〃 提交于 2019-12-02 02:23:58
Let's say that I have following strings: mail to tel:+358123456 http://www.google.fi mailto:foo@bar.fi hello world telephone elephant penny link owl How can I find only strings that do not start with 'tel:', 'http://' and 'mailto:' in RE2 syntax? I've tried following with following syntax, but it filters out all of them: [^(https?://|tel:|mailto:)] edit: RE2 syntax does not support negative lookbehind/lookahead. There is no drop-in workaround for the lack of negative lookbehind on RE2 that I know of. Why don't you match on strings that do start with those keywords instead? Then you can dismiss

linux、mac、windows10下php安装imagick

末鹿安然 提交于 2019-11-30 08:25:18
linux下 #imagick需要单独第三方的jpg和png支持,需要另外安装,linux应该已经有支持了,安装后可以支持jgp和png转换 #先安装pkg-config,默认安装在 /usr/local/bin/pkg-config wget http://pkgconfig.freedesktop.org/releases/pkg-config-0.28.tar.gz tar zxf pkg-config-0.28.tar.gz cd pkg-config-0.28 ./configure --with-internal-glib make sudo make install #付卸载方法 #sudo make uninstall #安装ImageMagick ImageMagick7好像不支持png wget http://www.imagemagick.org/download/ImageMagick.tar.gz tar zxf ImageMagick.tar.gz cd ImageMagick ./configure --prefix=/usr/local/imagemagick make sudo make install #linux下需要安装re2c 最新版本到下面完整查找 wget https://sourceforge.net/projects/re2c

Multiple regex matches in Google Sheets formula

我是研究僧i 提交于 2019-11-30 04:10:18
问题 I'm trying to get the list of all digits preceding a hyphen in a given string (let's say in cell A1 ), using a Google Sheets regex formula : =REGEXEXTRACT(A1, "\d-") My problem is that it only returns the first match... how can I get all matches ? Example text: "A1-Nutrition;A2-ActPhysiq;A2-BioMeta;A2-Patho-jour;A2-StgMrktg2;H2-Bioth2/EtudeCas;H2-Bioth2/Gemmo;H2-Bioth2/Oligo;H2-Bioth2/Opo;H2-Bioth2/Organo;H3-Endocrino;H3-Génétiq" My formula returns 1- , whereas I want to get 1-2-2-2-2-2-2-2-2

Split string and get last element

半世苍凉 提交于 2019-11-29 11:17:00
问题 Let's say I have a column which has values like: foo/bar chunky/bacon/flavor /baz/quz/qux/bax I.e. a variable number of strings separated by / . In another column I want to get the last element from each of these strings, after they have been split on / . So, that column would have: bar flavor bax I can't figure this out. I can split on / and get an array, and I can see the function INDEX to get a specific numbered indexed element from the array, but can't find a way to say "the last element"

Using positive-lookahead (?=regex) with re2

邮差的信 提交于 2019-11-28 13:24:17
Since I'm a bit new with re2 , I'm trying to figure out how to use positive-lookahead (?=regex) like JS, C++ or any PCRE style in Go . Here's some examples of what I'm looking for. JS: 'foo bar baz'.match(/^[\s\S]+?(?=baz|$)/); Python: re.match('^[\s\S]+?(?=baz|$)', 'foo bar baz') Note: both examples match 'foo bar ' Thanks a lot. According to the Syntax Documentation , this feature isn't supported: (?=re) before text matching re (NOT SUPPORTED) Also, from WhyRE2 : As a matter of principle, RE2 does not support constructs for which only backtracking solutions are known to exist. Thus,

Using positive-lookahead (?=regex) with re2

霸气de小男生 提交于 2019-11-27 07:39:15
问题 Since I'm a bit new with re2, I'm trying to figure out how to use positive-lookahead (?=regex) like JS, C++ or any PCRE style in Go. Here's some examples of what I'm looking for. JS: 'foo bar baz'.match(/^[\s\S]+?(?=baz|$)/); Python: re.match('^[\s\S]+?(?=baz|$)', 'foo bar baz') Note: both examples match 'foo bar ' Thanks a lot. 回答1: According to the Syntax Documentation, this feature isn't supported: (?=re) before text matching re (NOT SUPPORTED) Also, from WhyRE2: As a matter of principle,