I'm dealing with some email parsing and validation and I'm wondering if a valid email address can contain a newline character.
There's no way for e-mail address to contain a newline.
This should help: How to validate an email address using a regular expression?
Here's a diagram, note there's no 0x0a character anywhere:
Related
I need a printable character which is not available in the mobile SMS messages. The reason is that I have a file which has a bunch of data, and one of those data fields is SMS-text. It is dummy data ofcourse.
I need to extract this field. The tool I am using for it asks for a field-separator, on the basis of which it separates fields into a CSV file. And it uses a comma character as the default field separator.
Now the problem is that whenever a comma character occurs in SMS text, it separates the rest of the SMS text and makes it a separate field.
So my question is that how do I find a single character which I can use as a field separater in this case?
I think you can encode the text using Base64 before sending SMS, and then decode after receiving. Please see: https://en.wikipedia.org/wiki/Base64.
You may want to have a look at the GSM charset spec. Be aware about the 7bits / 8bits encoding and the encoding of the different (human) languages.
I need regular expression for multiple emails allowing comma and semicolon both.
I have used this pattern for comma separated emails:
[RegularExpression(RegexStrings.MULTIEMAILS, ErrorMessage = "Please enter valid email address(es)")]
But it is not working for semicolons.
What is the correct expression for multiple emails following either comma or semicolon with them?
I'm using the mini_fb gem in ruby to create an ad group:
response = fb_ads.create_ad_groups_with_image('adgroup_specs' => adgroup_specs)
If the ad text contains certain characters, such as ∑, this fails with the following error:
The text contains an invalid character. Ads may only contain alphanumeric characters, punctuation, and spaces. Note that line breaks and = are not allowed.
However, there are many other characters, such as π, ö é, î, ä, å, ç, è, and ø, that are accepted just fine. Is there a list somewhere of what characters Facebook accepts in its ads, or a quick API call that I can make to check whether a string will pass?
The Facebook Ads system allows ad titles and body text in most languages around the world. However the symbol you've pasted in above is in a Unicode range dedicated to mathematical symbols. It isn't allowed in the body or title of a Facebook ad. The character you entered (Unicode U2211) has a good alternate in the Greek alphabet range of Unicode at U03A3. Entering HTML entities is not going to render like you want.
I don't have a link for you, but it is very likely that Facebook only supports/allows extended ASCII characters in their ads. That would include the characters you listed, but the "sum" character you listed is not within extended ascii. Have you tried using html entities for the "special" characters you need?
how to allow special characters (like: ä, é, î, ø, ù) in uri in codeigniter
You cannot use special characters directly in URL's.
RFC 1738 contains the following paragraph:
URLs are written only with the graphic
printable characters of the US-ASCII
coded character set.
A list of characters in the US-ASCII character set can be found at http://www.columbia.edu/kermit/ascii.html.
Additionally, certain characters within that set are also reserved for certain purposes for example the "=" and "&" characters. These characters (and characters not included in the US-ASCII character set) must be encoded with the use of a % sign followed by the character reference.
You can encode these values within codeigniter using urlencode(). For example if you redirected a user using redirect(urlencode(http://test.com/ä)), they would be redirected to http://test.com/%E4 which is a valid URL.
To decode this percent code back into a normal character for display on your page, simply use urldecode() for example:
echo 'The character is: ' . urldecode($this->uri->segment(2));
I hope this helps.
Dan
You can configure this in your application/config folder, in the config.php file:
$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\-';
How can I create an array of email addresses contained within a block of text?
I've tried
addrs = text.scan(/ .+?#.+? /).map{|e| e[1...-1]}
but (not surprisingly) it doesn't work reliably.
Howabout this for a (slightly) better regular expression
\b[A-Z0-9._%+-]+#[A-Z0-9.-]+\.[A-Z]{2,4}\b
You can find this here:
Email Regex
Just an FYI, the problem with your email is that you allow only one type of separator before or after an email address. You would match "#" alone, if separated by spaces.