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 <.->.
Related
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:
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
I am using:
c.customerName =~ '(?i).*$q.*'
in order to find insensitive case any kind of customername and this is working absolutely fine for all standard character. In German unfortunately there are special chars e.g. like Ä,Ö,Ü. In this cases the cypher statement is case sensitive, e.g. if we have two customer names like Ötest and ötest it will find only one of them depending if you type a lower or an upper Ö.
Anyone has a hint what I can do to expand the insensitive case search also on such special chars?
EDIT: The problem exists also when you have a name including e.g. a '&' - you'll find e.g. the company D&A Construction when you type 'D&' - the moment you add a thrid character 'D&A' the search fails and no result is shown. Any idea?
You need to add a 'u' in your regex to transform it in a case-insensitive unicode regex. Like this:
c.customerName =~ '(?ui).*$q.*'
Works here:
From this StackOverflow question.
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
How do one code an email, say, alibaba#gmail.com to a***a#g***l.c*m in ruby on rails?
I found this when I tried to recover my password to my gmail account.
If you have the email already split into address and domain this is much easier. But to do that its simply:
email = 'alibaba#gmail.com'
address, domain = email.split('#')
If you don't care about the character count between the first and last of each token:
"#{address[0]}***#{address[-1]}"
for the a**a before the # and similar can be done for the domain but using split on the . character:
working_domain = domain.split('.')
"#{working_domain[0][0]}***#{working_domain[0][-1]}.#{working_domain[1][0]}*#{working_domain[1][-1]}"
That's a pretty ugly way to do it and its not very DRY and doesnt care about character counts. You should be able to encapsulate all of this into a function or 3 and make this simpler to use.
From the example you give in the question ("alibaba#gmail.com" => "a***a#g***l.c*m"), it appears you don't need the number of *'s to match the number of replaced characters. If that's the case, you can solve this with a simple regex substitution, no splitting or parsing of the address necessary:
email = 'alibaba#gmail.com'
email.gsub(/(?<=[\w\d])[\w\d]+(?=[\w\d])/, "**")
# => "a**a#g**l.c**m"
Breaking down that regex, just for clarity: [\w\d]+ matches strings of alphanumeric characters, excluding one alphanumeric to the left ((?<=[\w\d])) and another to the right ((?=[\w\d])) of each matched group, and replaces each match with "**".
I hope this helps.