Zapier regex: match after word - zapier

I am trying to extract string after a word match in Zapier, but it's not really working.
Input text is an email from Gmail and the search patter is the following:
(?<=Lic: )[^.\s]*
Example on regex101.com is working:
https://regex101.com/r/nSNnNM/1
On zapier I can't get it to match:

Related

Rails, Postgres 12, Query where pattern matches regex, and contains substring

I have a field in the database which contains strings that look like: 58XBF2022L1001390 I need to be able to query results which match the last letter(in this case 'L'), and match or resemble the last four digits.
The regular expression I've been using to find records which match the structure is: \d{2}[A-Z]{3}\d{4}[A-Z]\d{7}, So far I've tried using a scope to refine the results, but I'm not getting any results. Here's my scope
def self.filter_by_shortcode(input)
q = input
starting = q.slice!(0)
ending = q
where("field ~* ?", "\d{2}[A-Z]{3}\d{4}/[#{starting}]/\d{3}[#{ending}]\g")
end
Here are some more example strings, and the substring that we would be looking for. Not every string stored in this database field matches this format, so we would need to be able to first match the string using the regex provided, then search by substring.
36GOD8837G6154231
G4231
13WLF8997V2119371
V9371
78FCY5027V4561374
V1374
06RNW7194P2075353
P5353
57RQN0368Y9090704
Y0704
edit: added some more examples as well as substrings that we would need to search by.
I do not know Rails, but the SQL for what you want is relative simple. Since your string if fixed format, once that format is validated, simple concatenation of sub-strings gives your desired result.
with base(target, goal) as
( values ('36GOD8837G6154231', 'G4231')
, ('13WLF8997V2119371', 'V9371')
, ('78FCY5027V4561374', 'V1374')
, ('06RNW7194P2075353', 'P5353')
, ('57RQN0368Y9090704', 'Y0704')
)
select substr(target,10,1) || substr(target,14,4) target, goal
from base
where target ~ '^\d{2}[A-Z]{3}\d{4}[A-Z]\d{7}$';

Microsoft Graph API: query with $search by multiple fields

I'm trying to query Graph API messages with match on to and subject fields,
i.e.: https://graph.microsoft.com/v1.0/me/mailFolders/SentItems/messages?$search="to:email#example.com AND subject:something"
As I understand strict match search will be performed only if I'll wrap subject in double quotes
$search="to:email#example.com AND subject:"strict match""
This makes query invalid due to " nesting - how should I escape those quotes to make a valid query?
Also assuming I'm looking for a subject like: quote -> ' double quote -> ", how should the search param look like with both: to and subject that contains this example?
Thanks in advance.
You can use backslash operator to escape the double quotes.
https://graph.microsoft.com/v1.0/me/mailFolders/SentItems/messages?$search="to:email#example.com AND subject:\"strict match\""
Have a look at Search Tip and Tricks of the article below for appropriate search query:
https://learn.microsoft.com/en-us/Exchange/policy-and-compliance/ediscovery/message-properties-and-search-operators?view=exchserver-2019#searchable-properties-in-exchange
Search like "subject:\"test\"" returns all the messages where subject line has keyword "test". Strict search "subject:\"my test\"" returns all the messages where subject line has sentence "my test".
Please have a look at Subject searchable property in the article below:
https://learn.microsoft.com/en-us/graph/query-parameters#search-parameter
https://learn.microsoft.com/en-us/Exchange/policy-and-compliance/ediscovery/message-properties-and-search-operators?view=exchserver-2019

Non-greedy matching for email headers

Given an email header input like this
Cc: "'Johnny sudson'" <johnny#quvx.com>, <martin#quvx.com>,
<Joe#quvx.com>
how do I get lua to match only the email address? my intuition of it being <(.*)> or something similar only matches in a greedy fashion, where as I need entry individually....
my use case is something like this.
for emails in string.gmatch(all_cc,"<(.*)>" )
do
so I can then work with each email address individually
Non-greedy matching in Lua is represented in your case by <.->.

Regular expression which accept both email address and 10 digit phone number

I need an regular expression which accept 10 digit phone number and also email address with one input textfield.
Example :
Phonenumber: 1234567890
Emailaddress : somename#somecompany.com or somename#somecompany.in
Can any one advice me to get that regular expression.
#KiranMac123
Use the below regex to match the 10 digit phone number or an email address.
^(?:\d{10}|\w+#\w+\.\w{2,3})$
I would simply do this:
^(.+#.+|\d{10})$
Note that this regex does not match all valid email addresses. And it does match some that are not valid. But for most cases it's good enough.
Unless you have a good reason, I would strongly advice against using a regex to check email addresses. Read here why
I use something like this:
^(?:0\d{9}|\w+[-,_,.,\w]\w+#\w+.\w{2,3})$
It takes into consideration emails like:
word.word#word.dom
and
word-word#domain.com
Here's the explanation: Check on imgur

ruby regex is using last match to seperate string but should use first

Im parsing the source of a website and Im using this regex:
/page\.php\?id\=([0-9]*)\"\>(.*)\<\/a\>\<\/span\>/.match(self.agent.page.content)
self.agent.page.content contains the source of the page fetched by mechanize. The regex basicly works but in the secound match it does fetch more then it should because there are more then one <\/a\>\<\/span\> in the source and the regex uses the last one so I get a bunch of html crap. How can I tell the regex to use the first match as an "end marker"?
.* is greedy, whereas .*? is non-greedy. Try:
/page\.php\?id\=([0-9]*)\"\>(.*?)\<\/a\>\<\/span\>/.match(self.agent.page.content)

Resources