Question : need some kind of Regexp

Hi,

I have a string with words separated by spaces :
hello world this is a string

I need to get the word which is starting with 'str' for instance. In the example above, that would be 'string'.

Is it possible to do so, without splitting the words and looping through each of them ?

Thank you for any idea!

Answer : need some kind of Regexp

With any instance (line 4) :

1:
2:
3:
4:
5:
6:
7:
8:
<html><head></head><body>
<script language="javascript">
	var mystring = "hello world this is a string";
	var startBy = "str";
	var r = new RegExp( startBy + "\\w*\\s*" );
	alert( r.exec(mystring) );
</script>
</body></html>
Random Solutions  
 
programming4us programming4us