pcre

A strict regular expression for matching chemical formulae

早过忘川 提交于 2021-02-16 13:09:46
问题 In the course of processing a large textual chemical database with Perl, I had been faced with the problem of using a regex to match chemical formulae. I have seen these two previous topics, but the suggested answers there are too loose for my requirements. Specifically, my (admittedly limited) research has led me to this posting that gives a regex for the currently accepted chemical symbols, which I'll copy here for reference [BCFHIKNOPSUVWY]|[ISZ][nr]|[ACELP][ru]|A[cglmst]|B[aehikr]|C

A strict regular expression for matching chemical formulae

自闭症网瘾萝莉.ら 提交于 2021-02-16 13:06:28
问题 In the course of processing a large textual chemical database with Perl, I had been faced with the problem of using a regex to match chemical formulae. I have seen these two previous topics, but the suggested answers there are too loose for my requirements. Specifically, my (admittedly limited) research has led me to this posting that gives a regex for the currently accepted chemical symbols, which I'll copy here for reference [BCFHIKNOPSUVWY]|[ISZ][nr]|[ACELP][ru]|A[cglmst]|B[aehikr]|C

A strict regular expression for matching chemical formulae

淺唱寂寞╮ 提交于 2021-02-16 13:06:03
问题 In the course of processing a large textual chemical database with Perl, I had been faced with the problem of using a regex to match chemical formulae. I have seen these two previous topics, but the suggested answers there are too loose for my requirements. Specifically, my (admittedly limited) research has led me to this posting that gives a regex for the currently accepted chemical symbols, which I'll copy here for reference [BCFHIKNOPSUVWY]|[ISZ][nr]|[ACELP][ru]|A[cglmst]|B[aehikr]|C

Extracting `<key>=<value>` pairs with regex, dot group (.+?) not cooperating with optional space (\s)

徘徊边缘 提交于 2021-02-16 09:01:53
问题 I have this string: metadata=1.2 name=stone:supershare UUID=eff4e7bc:47aea5cf:0f0560f0:2de38475 I wish to extract from it the key and value pairs: <key>=<value> . /(\w+)=(.+?)\s/g This, as expected, doesn't return the UUID pair, due to not being followed by space: [ "metadata=1.2 ", "name=stone:supershare " ], [ "metadata", "name" ], [ "1.2", "stone:supershare" ] Now, obviously, we should make the \s lookup optional: /(\w+)=(.+?)\s?/g Though, this goes utterly nuts extracting only the first

Extracting `<key>=<value>` pairs with regex, dot group (.+?) not cooperating with optional space (\s)

Deadly 提交于 2021-02-16 08:59:34
问题 I have this string: metadata=1.2 name=stone:supershare UUID=eff4e7bc:47aea5cf:0f0560f0:2de38475 I wish to extract from it the key and value pairs: <key>=<value> . /(\w+)=(.+?)\s/g This, as expected, doesn't return the UUID pair, due to not being followed by space: [ "metadata=1.2 ", "name=stone:supershare " ], [ "metadata", "name" ], [ "1.2", "stone:supershare" ] Now, obviously, we should make the \s lookup optional: /(\w+)=(.+?)\s?/g Though, this goes utterly nuts extracting only the first

Extracting `<key>=<value>` pairs with regex, dot group (.+?) not cooperating with optional space (\s)

流过昼夜 提交于 2021-02-16 08:59:08
问题 I have this string: metadata=1.2 name=stone:supershare UUID=eff4e7bc:47aea5cf:0f0560f0:2de38475 I wish to extract from it the key and value pairs: <key>=<value> . /(\w+)=(.+?)\s/g This, as expected, doesn't return the UUID pair, due to not being followed by space: [ "metadata=1.2 ", "name=stone:supershare " ], [ "metadata", "name" ], [ "1.2", "stone:supershare" ] Now, obviously, we should make the \s lookup optional: /(\w+)=(.+?)\s?/g Though, this goes utterly nuts extracting only the first

PCRE pcre_exec thread safe?

自作多情 提交于 2021-02-10 06:14:03
问题 I have a C program that uses a PCRE regex to determine if a process in a cgroup should be added to one variable or another. I spawn a thread to read the cpuacct.stat file in each running cgroup, where the number of threads never exceeded the number of cores. These samples and results are then combined into one of two variables. The relevant snippet of code is: pcreExecRet = pcre_exec(reCompiled, pcreExtra, queue, strlen(queue), // length of string 0, // Start looking at this point 0, //

PCRE pcre_exec thread safe?

孤人 提交于 2021-02-10 06:13:05
问题 I have a C program that uses a PCRE regex to determine if a process in a cgroup should be added to one variable or another. I spawn a thread to read the cpuacct.stat file in each running cgroup, where the number of threads never exceeded the number of cores. These samples and results are then combined into one of two variables. The relevant snippet of code is: pcreExecRet = pcre_exec(reCompiled, pcreExtra, queue, strlen(queue), // length of string 0, // Start looking at this point 0, //

PCRE issue when setting up WSGI application

冷暖自知 提交于 2021-02-07 01:57:38
问题 I am working with Ubuntu 16.04.2 LTS. I have been following a guide How To Set Up uWSGI and Nginx to Serve Python Apps on Ubuntu 14.04. Once I have set up the virtualenv I follow the instructions: pip install uwsgi You can verify that it is now available by typing: uwsgi --version If it returns a version number, the uWSGI server is available for use. However when I do this I get: uwsgi: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or

PCRE issue when setting up WSGI application

懵懂的女人 提交于 2021-02-07 01:56:36
问题 I am working with Ubuntu 16.04.2 LTS. I have been following a guide How To Set Up uWSGI and Nginx to Serve Python Apps on Ubuntu 14.04. Once I have set up the virtualenv I follow the instructions: pip install uwsgi You can verify that it is now available by typing: uwsgi --version If it returns a version number, the uWSGI server is available for use. However when I do this I get: uwsgi: error while loading shared libraries: libpcre.so.1: cannot open shared object file: No such file or