I am calling one API that takes phone number as an input and provide response matching that phone number.
URL ends with this:
https://www.something.com/something&api_key=xxxx&sig=xxxx+"&%24filter=endswith(MobilePhone%2c'1234512345')
If in server mobile number is saved in same format as specified in url, that time it is giving me correct response.
But the problem is: If in server phone number is saved in different format like 12-3451-2345(with hyphen) or 12 3451 2345(with space), that time it is giving me empty response.
I tried using regular expression and wild card character in the above url, so that even if the hyphen and spaces are present in phone number in server, it should give me the correct response. But it didn't work. Please help me out with this.
Thanks in advance.
Related
I have the requirement to validate an email using the following conditions
If the email name (the part before the # sign) entered starts with a period (.) the system should display a message error. Example:.mail#mail.com.
If the email name has characters different than the ones in the ASCII-US table, the system should display an error message.
If the email name ends with a period, the system should display an error message. Example: mail.#mail.com.
If the email name is longer than 64 characters, the system should display an error message.
If the complete email address is longer than 254 characters, the system should display an error message.
If the hostname (part after # sign) does not starts with a letter or number (a-z and 0-9 characters), the system should display an error message.
If the host name should always have a period but shouldn't end with one.
If the host name is larger than 63 characters, the system should display an error message.
I am using this following regex which satisfies all of them except the (7) where there should be a 'period' compulsorily present in the hostname, it fails at emails like "abc#efg"
/^(?=.{1,254}$)(?=.{1,64}#)[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*#[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/
I need to keep this same regex as it satisfies all other conditions except the one i mentioned, what change can I make to satisfy that condition as well
After a few trial and errors I formulated the following regexp which takes care of all the above required criteria. Adding the answer here for anyone that stumbles across this in the future.
/^(?=.{1,254}$)(?=.{1,64}#)[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-zA-Z0-9!#$%&'*+/=?^_`{|}~-]+)*#[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+$/
I have a form in MS Word which the user fills and emails me. I have to open the form and capture all the details entered by the user and use the same to submit a form in my portal.
I am trying to create a robot using Robocorp to automate this process. Using "Get All texts" - RPA Word library, I am logging the contents from the Word document in Robocorp and then trying to get the required data using Regex but need some help on extracting the data using Regex.
Please find the raw text logged in Robocorp below,
Source Text
Query 1:
Need to extract Manager name:
In Regex101, I am getting the name returned as expected upon using, [^Manager\n].*
In Robocorp, when I use 'Get regex matches' with [^Manager\n].*, I am getting all the content of the text file.
Please help me with the regex to use in Robocorp to extract the Manager name.
Query 2:
I need to extract the answers provided by the user for the questions in the above form. (Note: The answers change with every form submitted)
I tried the below,
For eg: I pulled one question first from the above form using - Get Regex matches (?s)(Lunch).*?(No).
I got the below value returned in robocorp,
['Lunch account required? \x07☒ Yes\r☐ No']
Now again from this value returned (using this as string), I tried to get the answer selected by the user using,
Get Regex matches (?<=☒)\s\w+
But I am getting the error "TypeError: expected string or bytes-like object".
Not sure, If the above flow is right or can I get the answers selected by the user for all questions in a different way?
Sorry if my questions are simple. I am totally new to using Regex and in my learning phase.
I would like to add a phone number to a word document that I generate using the mso api.
In word, when one writes (Tel:00493298402938) and new line, the phone number is activated automatically.
While trying to record the corresponding macro and check the VBA code, it doesn't show the same behavior and the phone number is interpreted as a normal text.
Any helpful source code in VBA, C# or C++ is welcome.
Thanks!
Maybe the following code would be helpful to you?
ThisWorkbook.ActiveSheet.Hyperlinks.Add Range("A1"), "http://stackoverflow.com"
Just instead of the web address you would need the phone number.
I am following each step to create a signature for my url requests to amazon(or at least that's what I think) but it doesn't work.
I am trying to sign an example from the amazon's page( http://docs.aws.amazon.com/AWSECommerceService/latest/DG/rest-signature.html
I have downloaded the s3-sigtester, a javascript file that creates the signatures. The string that I am signing is:
GET \necs.amazonaws.co.uk \n/onca/xml \nAWSAccessKeyId=AKIAJOCH6NNDJFTB4LYA&Actor=Johnny%20Depp&AssociateTag=memagio-21&Operation=ItemSearch&ResponseGroup=ItemAttributes%2COffers%2CImages%2CReviews%2CVariations&SearchIndex=DVD&Service=AWSECommerceService&Sort=salesrank&Timestamp=2014-10-19T21%3A21%3A55Z&Version=2009-01-01
The string above is the result from the sigtester. I am feeding it in hex. I get a signature and then, I am trying to access the following url, in order to get the xml values:
http://ecs.amazonaws.co.uk/onca/xml?AWSAccessKeyId=AKIAJOCH6NNDJFTB4LYA
&Actor=Johnny%20Depp&AssociateTag=memagio-21&Operation=ItemSe
arch&ResponseGroup=ItemAttributes%2COffers%2CImages%2CReviews%2CV
ariations&SearchIndex=DVD&Service=AWSECommerceService&Signature=vZK%2BhDqtcV1CoTf6%2FN1ohR3Da5M%3D&Sort=salesrank&Ti
mestamp=2014-10-19T21%3A21%3A55Z&Version=2009-01-01
The AWASCcessKeyId and signature key are the AWS keys that I have created. However, I get an error that the signatures do not match. I think that I am following all the steps and I really don't know what's going on. Thanks.
The string that I am signing is:
GET \necs.amazonaws.co.uk \n/onca/xml \nAWSAccessKeyId=AKIAJOCH6NNDJFTB4LYA&Actor=Johnn
I assume \n denotes a newline character (Unicode 000A). The problem is that there should not be spaces before the newlines - it needs to be GET\necs.amazonaws.co.uk\n...
I am using Green Text Account and using http://developer.textapp.net/WebService api call for sending sms. In that we are taking mobile number from user and sending sms.
I am having query, if user in UK doesn’t enter the country code(+44) whether he can get the message if he enters mobile number in the format with leading zero and the server is in UK only.
The documentation for the Destinations parameter used in the SendSMS method says:
Phone numbers must be formatted in their full international format,
beginning with a +, followed by the appropriate country code, with
the removal of any leading zeros, and with no extraneous characters
or spaces. Numbers can include both mobile and landline numbers.
For example, mobile number (07836) 123-456 would be formatted as
+447836123456.
An example of a string containing multiple numbers:
+336456232125,+617766789712,+447836123456