Search results for 'Regular Expression'. 3 post(s) found.

  1. 2008/01/25 Javascript based Browser Sniffing
  2. 2008/01/15 Javascript based Regular Expression Tester
  3. 2007/09/12 The three simplest regular expressions you will use in PHP
2008/01/25 14:35

Javascript based Browser Sniffing


The javascript browser snifer makes an extensive use of Regular Expressions and the search() and match() functions.

By this function, you can know following information:
[1] browser type
[2] browser version
[3] os type
[4] os version
[5] flash installation information

Actually this script is effective when making web log.

The following is the example of Javascript based Browser Sniffing.

<script type="text/javascript" src="js/brwsniff.js"></script>

<script type="text/javascript">
  var br=new Array(4);
  var os=new Array(2);
  var flash=new Array(2);
  br=getBrowser();
  os=getOS();
  flash=hasFlashPlugin();
  document.write("Browser identifier: "+br[0]+"<br />");
  document.write("Browser version: "+br[1]+"<br />");
  document.write("Browser major version: "+getMajorVersion(br[1])+"<br />");
  document.write("Browser minor version: "+getMinorVersion(br[1])+"<br />");
  document.write("Browser engine: "+br[2]+"<br />");
  document.write("Browser engine version: "+br[3]+"<br />");
  document.write("Full user agent string: "+getFullUAString()+"<br />");
  document.write("Operating system identifier: "+os[0]+"<br />");
  document.write("Operating system version: "+os[1]+"<br />");
  document.write("Is Flash installed? " + (flash[0]==2 ? "Yes" : (flash[0] == 1 ? "No" : "unknown")) + "<br />");
  document.write("Flash version: "+flash[1]+"<br />");
</script>

You can download the latest full script and demo at http://jsbrwsniff.sourceforge.net/ 

Trackback 3 Comment 0

Trackback : Cannot send a trackbact to this post.

  1. Subject different money making ideas

    Tracked from moneyideas 2010/01/28 23:47 delete

    moneyideas

  2. Subject different money making ideas

    Tracked from moneyideas 2010/01/29 07:59 delete

    moneyideas

  3. Subject different money making ideas

    Tracked from moneyideas 2010/01/31 16:43 delete

    moneyideas

2008/01/15 11:35

Javascript based Regular Expression Tester


Here's JavaScript based Regular Expression Tester.

JavaScript (or Microsoft's variant JScript) will need to be enabled in your browser.

Actually this test program is not proper for you to test the complex combination of Regular Expression supported by RegExp function.


RegExp

Subject string

Replacement text

Result



<script language="JavaScript"><!--
function frm1Click()
{
  var re = new RegExp(document.frm1.regex.value);
  if (document.frm1.subject.value.match(re))    alert("Successful match");
  else alert("No match");
}

function show()
{
  var re = new RegExp(document.frm1.regex.value);
  var m = re.exec(document.frm1.subject.value);
  if (m == null) alert("No match");
  else
  {
    var s = "Match at position " + m.index + ":\n";
    for (i = 0; i < m.length; i++) s = s + m[i] + "\n";
    alert(s);
  }
}

function frm1_replace_Click()
{
  var re = new RegExp(document.frm1.regex.value, "g");
  document.frm1.result.value =
    document.frm1.subject.value.replace(re,
      document.frm1.replacement.value);
}
// -->
</script>

<form id="frm1" name="frm1" method="post" action="javascript:void(0)">
RegExp<br>
<textarea cols="50" rows="4" name="regex">l(.*?)e</textarea><br />
Subject string<br>
<textarea cols="50" rows="4" name="subject">I love you.</textarea><br />
<p><input value="Test Match" onclick="frm1Click()" type="submit">
<input value="Show Match" onclick="show()" type="submit"></p>

Replacement text<br>
<textarea cols="50" rows="4" name="replacement">hate</textarea><br />
Result<br>
<textarea cols="50" rows="4" name="result">click the button to see the result</textarea><br />
<input value="Replace" onclick="frm1_replace_Click()" type="submit">
</form>

Trackback 3 Comment 0

Trackback : Cannot send a trackbact to this post.

  1. Subject different money making ideas

    Tracked from moneyideas 2010/01/29 02:24 delete

    moneyideas

  2. Subject different money making ideas

    Tracked from moneyideas 2010/01/29 10:40 delete

    moneyideas

  3. Subject different money making ideas

    Tracked from moneyideas 2010/01/31 16:43 delete

    moneyideas

2007/09/12 16:46

The three simplest regular expressions you will use in PHP


The three most basic searches using Regular Expressions are searching for the strings start, the strings end, or for characters it contains. We can do these using the following symbols:

^ indicates the string starts with the specified characters, so "^strcpy" would match any string starting with "strcpy". This would match "strcpy.com is nice" or "strcpy the pirates" but would not match "out and strcpy".

$ indicates that a string finishes with the specified characters, so "strcpy$" would match any string that ended with "strcpy". This what match "What is it strcpy" or "Out and strcpy" but would not match "strcpy.com is nice"

"strcpy" looks for the characters specified within the quotes, anywhere within the string.

This means not only would it match "strcpy.com is nice" and "out and strcpy" it would match "Something about Mary"

These can be combined and used together. Let's say that you only wanted to match the word strcpy, and not any sentances it may be contained in. You might try combining start and end searches like this:

"^strcpy$" This would match only strings that both start and end with strcpy, which applies to a the word "strcpy".
Trackback 7 Comment 0

Trackback : Cannot send a trackbact to this post.

  1. Subject Underage pedo incest gir.

    Tracked from Underage girl in thong. 2009/01/16 15:25 delete

    Teen underage. Underage drinking. Underage. Underage naked. Underage sex stories. Underage sex.

  2. Subject Incest comics.

    Tracked from Incest. 2009/02/06 16:02 delete

    Free incest pics. Incest taboo rape photo. Incest. Free incest porn. Mom son incest. Incest porn.

  3. Subject Cheapest cialis.

    Tracked from Cialis st. 2009/02/11 13:49 delete

    Cialis canada. Side effects of cialis. Cialis best price buy online. Cialis.

  4. Subject Incest rape.

    Tracked from Gang rape. 2009/02/11 18:58 delete

    Rape fantasies. Free rape video. Rape stories. Rape sex. Rape story. Stories of rape. Japanese rape. Rape.

  5. Subject different money making ideas

    Tracked from moneyideas 2010/01/28 23:20 delete

    moneyideas

  6. Subject different money making ideas

    Tracked from moneyideas 2010/01/29 07:24 delete

    moneyideas

  7. Subject different money making ideas

    Tracked from moneyideas 2010/01/31 16:39 delete

    moneyideas