Ultimater
05-16-2007, 06:12 PM
I've been trying to convert an entire PHP function to JavaScript which converts alphabetical characters to Hebrew characters. One of the regular expressions my PHP uses is:
<?php
preg_match_all('/[A-Z][a-z]*?|./U',$strin,$result);
?>
Although JavaScript doesn't come with a "U" modifier.
If I'm not mistaken is my PHP also the same as saying:
<?php
preg_match_all('/[A-Z][a-z]*|./',$strin,$result);
?>
One more question, is the above the same as:
<?php
preg_match_all('/[A-Z][a-z]*|[\s\S]/',$strin,$result);
?>
Answer me the PHP questions then I'll be able to solve the JavaScript one.
If you care to see what my JavaScript looks like so far:
<script type="text/javascript">
result=new String(strin).match(/[A-Z][a-z]*|[\s\S]/g);
</script>
I'm just not sure if it is an equivalent or if there are any small differences between the two.
<?php
preg_match_all('/[A-Z][a-z]*?|./U',$strin,$result);
?>
Although JavaScript doesn't come with a "U" modifier.
If I'm not mistaken is my PHP also the same as saying:
<?php
preg_match_all('/[A-Z][a-z]*|./',$strin,$result);
?>
One more question, is the above the same as:
<?php
preg_match_all('/[A-Z][a-z]*|[\s\S]/',$strin,$result);
?>
Answer me the PHP questions then I'll be able to solve the JavaScript one.
If you care to see what my JavaScript looks like so far:
<script type="text/javascript">
result=new String(strin).match(/[A-Z][a-z]*|[\s\S]/g);
</script>
I'm just not sure if it is an equivalent or if there are any small differences between the two.