Email Regex for Javascript Which not start with Number [closed] - javascript

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
^[a-zA-Z]\w+#[a-zA-Z_]+?\.[a-zA-Z]{2,4}$
i had tried this regex for email but it allow following cases
123#mail.com
example.mail#mail.com

Here is the code which searches for the number at the start.
If number is matched it prints message in console.
let regex = /^[0-9]/;
let object = [{email:'123#mail.com'},{email:'example.mail#mail.com'}];
for(let i =0;i<object.length;i++){
if(object[i].email.match(regex)){
console.log('E-mail ',object[i].email,' is not valid.')
}
}
This is the used regex: ^[0-9]

Related

How to separate a string into a sentence without a proper patern [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
The community is reviewing whether to reopen this question as of 2 years ago.
Improve this question
I have a data that looks like this
Huawei Y7P Art-L28 (4/64gb) (AAAAAAAAAAAAAA) EXP:02/19/2020
Huawei Y9 prime 2019 (BBBBBBBBBBBBBBB) EXP:07/17/2019
Oppo A31 4gb/128gb (CCCCCCCCCCCCCCC)
Vivo Y15 5000mah 4GB/64GB (1901) (DDDDDDDDDDDDDDD) EXP:06/14/2019
And the I want to get this data
AAAAAAAAAAAAAA
BBBBBBBBBBBBBBB
CCCCCCCCCCCCCCC
DDDDDDDDDDDDDDD
Basically what I want to happen is to extract the data from the set of word but my problem here is that its very unpredictable. It has no pattern at all so its hard to separate the string.
Assuming that you need a substring in last parenthesis:
SELECT SUBSTRING_INDEX(SUBSTRING_INDEX(column, '(', -1), ')', 1)
FROM source_table

Auto create links in text following a pattern [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I need to to search through the document text and where it finds a pattern of 0000/0, 0000/00 or 0000/000 (where 0 can be any number) it automatically wraps that text in
0000/00
What I found for auto linkers are only when text is a URL, so it doesn't really help with what I need.
A simple regex pattern would do the trick.
text.replace(/(0000\/[0-9]{1,3})/gm, `$1`);
This will look for 0000/ followed by numbers between 0 and 9, 1 to 3 times.
simple regexp approach
document.body.innerHTML = document.body.innerHTML.replace(/(\d{4}\/\d{1,3})/g,
'$1')
Some text 0000/0 and this 1234/56 and that 7777/666

Cut a string into two parts before any digit in js? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
What I have:
add-category
add-exam
a-category1
a-category2
...
a-category[n]
What I need:
I need to cut string on two parts as 'a-category' and '1' or just 'add-exam' if no digit in row.
let str = 'a-category2';
let splitStr = str.split(/(\d+)/);
console.log('string--->' + splitStr[0]);
console.log('digit---->' + splitStr[1]);

Select >|< from string between quotes [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
I have a string like this: *ngIf="thisThing > 0"
Using RegEx, I'd like to select/return ONLY the > or in some cases, <.
I have the following expression: (?<=")(?:.*?)(<|>)(?:.*?)(?=") but this still selects everything inside the quotes. I only want to match that >.
I've been testing it here: https://regex101.com/r/4KPfbT/1
I guess you're over-complexifying it. Why not this way:
\w*=".*([<>]).*"
It works, take a look:
console.log('*ngIf="thisThing > 0"'.match(/w*=".*([<>]).*"/)[1])
console.log('whatever="otherThing < 999"'.match(/w*=".*([<>]).*"/)[1])

String to integer conversion using javascript [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
I have a two textbox and i want to convert string value such as "apple" and "cat" into appropriate integer value using javascript.
Simple...
var myInt = "cat";
var converted = parseInt(myInt, 10);
console.log(converted);
>>NaN

Categories

Resources