Visual Regex

Posted by Jetlogs @ 2:49 pm
Category: Web Development

Regex: its usually a bane for most developers and programmers to the point that most regex patterns in the wild are usually cut and paste from the web or text books. Even I admit that I’m guilty of this.

However, wouldn’t it be better if we learn how the regex pattern we input works? Good thing is, there is already such a thing! The website strfriend transforms a RegEx pattern into a simple chart that is easier to understand.

Here is an example:
Visual Regex
This is actually from a RegEx I used for matching all XML schema elements and attribute groups that doesn’t use a closing tag that have a ref attribute.

<xs:(element|attributeGroup) ref=”[^"\r\n]*”[^\r\n/>]*/>

For those who are curious, here is the other RegEx I used for matching those XML schema elements / attribute groups with closing tags that have a ref attribute:

<xs:(element|attributeGroup) ref=”[^"\r\n]*”[^\r\n/>]*>(.|\r\n|\n)+?</xs:(element|attributeGroup)>


Javascript Keypress Validations

Posted by Jetlogs @ 10:48 am
Category: Web Development, jQuery

Most client-side validation nowadays is usually made through onsubmit validations. Although it is pretty convenient, it may be quite annoying for a user to find only at the end that most of their inputs are invalid and must enter them once again. If onblur validations is not enough, keyperss validation is the next step.

Here is another alternative to the usual onsubmit validations for forms. Instead of validating a form only at the end, why not validate it as the user is typing their input. This is where keypress validations come in. We can capture it through the onkeypress event.

Here are some examples of keypress validations:

Only integers are allowed:
Only alphanumeric characters are allowed:
No spaces are allowed:

Here is an example keypress validation function: Read more »


PHP, Regex, and E-mail security

Posted by Jetlogs @ 10:44 pm
Category: PHP, Web Development

While I was securing an email form at work, I noticed that making a secure web form in PHP is really hard if not impossible. While reading the server logs, I found that spammers were now using email form injections to send spam. Let’s analyze why its hard to properly secure a web form: Read more »


  • Archives

  • Donations

  • Social Bookmarks

  • Jetlogs.org
    Some Rights Reserved 2007
    Creative Commons License