Click here to Skip to main content
14,447,769 members

JavaScript

 
QuestionSTOP VALIDATION Pin
Member 1344978425-Oct-18 1:44
MemberMember 1344978425-Oct-18 1:44 
AnswerRe: STOP VALIDATION Pin
Afzaal Ahmad Zeeshan25-Oct-18 3:40
mvaAfzaal Ahmad Zeeshan25-Oct-18 3:40 
Questionno me funciona funcion autocomplete Jquery Pin
serenimus20-Oct-18 9:53
Memberserenimus20-Oct-18 9:53 
AnswerRe: no me funciona funcion autocomplete Jquery Pin
Nelek20-Oct-18 9:59
protectorNelek20-Oct-18 9:59 
QuestionMap JSON data file with dates and multiple string value pairs to Angular/Chart.js Pin
Member 1201357914-Oct-18 23:08
MemberMember 1201357914-Oct-18 23:08 
Questionaspx file don't open in chrome Pin
anasr200010-Oct-18 3:22
professionalanasr200010-Oct-18 3:22 
Questiontest regexep javascript Pin
Alboyz5-Oct-18 5:31
MemberAlboyz5-Oct-18 5:31 
AnswerRe: test regexep javascript Pin
Richard Deeming5-Oct-18 5:48
communityengineerRichard Deeming5-Oct-18 5:48 
Alboyz wrote:
var data1 =/learning+\s+html+/g.test(data1)

You're trying to use the variable data1 before it has any value assigned to it.

Your regular expression is also slightly off: the + means the previous element can be repeated one or more times, so you'll match "learninggggg". You're also testing for "html" instead of "javascript".

You'll probably was a case-insensitive regex, so that you match "JavaScript" or "Javascript" as well as "javascript".

Assuming you've missed the first line of your function:
function panggilRegexp(input) {
    var isMatch = /learning\s+javascript/gi.test(input);
    if (isMatch) {
        console.log("learning javascript");
    }
    else {
        console.log("learning");
    }
}

panggilRegexp("Are you learning JavaScript yet?");

Regular Expressions - JavaScript | MDN[^]
JavaScript RegExp Reference[^]
Regex testing tool[^]



"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer

GeneralRe: test regexep javascript Pin
Alboyz5-Oct-18 6:02
MemberAlboyz5-Oct-18 6:02 
GeneralRe: test regexep javascript Pin
uxotucung9-Nov-18 4:09
Memberuxotucung9-Nov-18 4:09 
QuestionAdding a list of files to the array and displaying them in the component Pin
Member 140077214-Oct-18 5:33
MemberMember 140077214-Oct-18 5:33 
QuestionDate picker style not showing Pin
thepast24-Sep-18 9:21
Memberthepast24-Sep-18 9:21 
AnswerRe: Date picker style not showing Pin
ZurdoDev24-Sep-18 9:58
mveZurdoDev24-Sep-18 9:58 
GeneralRe: Date picker style not showing Pin
Iniciativa Box Funcional25-Sep-18 8:36
MemberIniciativa Box Funcional25-Sep-18 8:36 
QuestionRelation between null and zero. Pin
GKP199222-Sep-18 22:21
professionalGKP199222-Sep-18 22:21 
AnswerRe: Relation between null and zero. Pin
Richard Deeming24-Sep-18 9:03
communityengineerRichard Deeming24-Sep-18 9:03 
GeneralRe: Relation between null and zero. Pin
GKP199224-Sep-18 18:37
professionalGKP199224-Sep-18 18:37 
QuestionTypeScript, Dropping Image and loading preview without posting, a working sample, FileReader, readAsDataUrl, reader.result Pin
jkirkerx19-Sep-18 8:55
professionaljkirkerx19-Sep-18 8:55 
QuestionCan't match this string in typescript using if and else if Pin
jkirkerx18-Sep-18 14:04
professionaljkirkerx18-Sep-18 14:04 
AnswerRe: Can't match this string in typescript using if and else if Pin
Graham Breach18-Sep-18 22:21
MemberGraham Breach18-Sep-18 22:21 
GeneralRe: Can't match this string in typescript using if and else if Pin
jkirkerx19-Sep-18 8:27
professionaljkirkerx19-Sep-18 8:27 
QuestionCan't match this string in typescript using if and else if Pin
jkirkerx18-Sep-18 14:04
professionaljkirkerx18-Sep-18 14:04 
QuestionHow to cancel a drag event Pin
jkirkerx18-Sep-18 10:25
professionaljkirkerx18-Sep-18 10:25 
AnswerRe: How to cancel a drag event Pin
Richard Deeming18-Sep-18 11:53
communityengineerRichard Deeming18-Sep-18 11:53 
GeneralRe: How to cancel a drag event Pin
jkirkerx18-Sep-18 12:54
professionaljkirkerx18-Sep-18 12:54 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.