bugcoder Posted June 18, 2010 Share Posted June 18, 2010 Too weak with regex statments. what regex statment can work here. have two variables variableOne and variableTwo and i dont want variableOne value to be the part of variableTwo anywhere in it. Quote Link to comment https://forums.phpfreaks.com/topic/205173-regex-statment/ Share on other sites More sharing options...
salathe Posted June 18, 2010 Share Posted June 18, 2010 Please ask a question. Quote Link to comment https://forums.phpfreaks.com/topic/205173-regex-statment/#findComment-1073944 Share on other sites More sharing options...
bugcoder Posted June 18, 2010 Author Share Posted June 18, 2010 well i have asked the question :-\ however if i want to elobrate it with code then its like this username = 'myusername' password = '12myusername89' return /WhatShouldBeHere/i.test(password); what regex statement should be used in above line so that it return false in this case because i dont want username value to be part of password anywhere in it. Quote Link to comment https://forums.phpfreaks.com/topic/205173-regex-statment/#findComment-1073958 Share on other sites More sharing options...
haku Posted June 18, 2010 Share Posted June 18, 2010 You didn't actually ask a question. You stated a problem. But as to how to deal with that problem: if(password.indexOf(username) != -1) { // match found } You don't need regex for this situation. Quote Link to comment https://forums.phpfreaks.com/topic/205173-regex-statment/#findComment-1073980 Share on other sites More sharing options...
Maq Posted June 18, 2010 Share Posted June 18, 2010 You don't need a regex for that. var username = 'myusername' var password = '12myusername89' if(password.indexOf(username) != -1) { } else { } Quote Link to comment https://forums.phpfreaks.com/topic/205173-regex-statment/#findComment-1073981 Share on other sites More sharing options...
haku Posted June 18, 2010 Share Posted June 18, 2010 I saw your post and wondered why the board put your name on my post, until I realized that we both had pretty much exactly the same code Quote Link to comment https://forums.phpfreaks.com/topic/205173-regex-statment/#findComment-1073983 Share on other sites More sharing options...
Maq Posted June 18, 2010 Share Posted June 18, 2010 I saw your post and wondered why the board put your name on my post, until I realized that we both had pretty much exactly the same code Hate when that happens Quote Link to comment https://forums.phpfreaks.com/topic/205173-regex-statment/#findComment-1073987 Share on other sites More sharing options...
bugcoder Posted June 18, 2010 Author Share Posted June 18, 2010 Thanks a lot both gurus Quote Link to comment https://forums.phpfreaks.com/topic/205173-regex-statment/#findComment-1073988 Share on other sites More sharing options...
Maq Posted June 18, 2010 Share Posted June 18, 2010 Thanks a lot both gurus There was actually 3 Quote Link to comment https://forums.phpfreaks.com/topic/205173-regex-statment/#findComment-1073991 Share on other sites More sharing options...
bugcoder Posted June 18, 2010 Author Share Posted June 18, 2010 oh yeah saw know:D Quote Link to comment https://forums.phpfreaks.com/topic/205173-regex-statment/#findComment-1073997 Share on other sites More sharing options...
Maq Posted June 18, 2010 Share Posted June 18, 2010 oh yeah saw know:D Yeah it was just Salathe... no one really cares about him anyway. Quote Link to comment https://forums.phpfreaks.com/topic/205173-regex-statment/#findComment-1074000 Share on other sites More sharing options...
bugcoder Posted June 18, 2010 Author Share Posted June 18, 2010 Yeah it was just Salathe... no one really cares about him anyway. here i need guru experience to be part of your laughter:D Quote Link to comment https://forums.phpfreaks.com/topic/205173-regex-statment/#findComment-1074006 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.