ken_shoti
05-16-2007, 03:44 AM
i want to do a whole word search...using this code:
<script>
x='mawmaw maw mawmaw'
regsearchtxt=new RegExp('\\W+maw\\W+','g')
if(x.search(regsearchtxt)!=-1){alert('h')}
</script>
and gladly it works...
but if used:
x='maw mawmaw'
it won't...using ^ might be the solution....but it solves the problem but creates bigger problems... same also for x='mawmaw maw'
any suggestions?
<script>
x='mawmaw maw mawmaw'
regsearchtxt=new RegExp('\\W+maw\\W+','g')
if(x.search(regsearchtxt)!=-1){alert('h')}
</script>
and gladly it works...
but if used:
x='maw mawmaw'
it won't...using ^ might be the solution....but it solves the problem but creates bigger problems... same also for x='mawmaw maw'
any suggestions?