Blogs

  • Browse Blogs
  • My Blog
  • My Updates

Tags Help

  • View as cloud  | list

Similar Blogs

photo

B's Blog

29 Entries |  Bob Seifert
Updated 
No Ratings 0     Comments 22
photo

Lotus Nut

74 Entries |  Chris Whisonant
Updated 
Ratings 6     Comments 101
photo

Yellow is the...

56 Entries |  Tim Tripcony
Updated 
No Ratings 0     Comments 23
photo

FlowerPower

35 Entries |  James T Kork
Updated 
No Ratings 0     Comments 20
photo

Smith's State...

14 Entries |  Peter Smith
Updated 
No Ratings 0     Comments 6

Dogear Bookmarks

Simon O'Doherty

Blog Authors:  Simon O'Doherty  

All entries tagged with regex

Common regular expressions for Widgets

Simon O'Doherty  |    |  Tags:  widgets regex  |  Comments (0)
One of the most powerful features for Notes R8.0.1+ is Widgets. If you are not familar with widgets I recommend checking out the tutorial.

However to get the full reach of that feature you do need to know regular expressions. If your a developer that is all well and good, but for your average user it can look very cryptic.

So here are a few easy to remember commands.
\w = Alphanumeric character (A to Z, a to z, 0 to 9)
\W = Not an Alphanumeric character (everything not above)
\d = Numeric digit (0 to 9)
\D = Non-numeric character (not 0 to 9)
\s = Whitespace. This is a space, tab, newline.
\S = Not a whitespace.
. = Match any character.
{x,y} or {x} = repeat the match. x is minimum number of times, y is maximum number of times.
( ) = Grouping your match (more on that later).
[ ] = range of characters to match.
There are many more commands but just with this handful of commands you should be able to match pretty much everything.

So for example. Lets say you have a Part number as follows.
XYZ12345A1A7
There a number of ways to match this. So you need to break it down into the components. For the example we will define the part number as...
XYZ = three characters upper case.
12345 = Five digits
A1A7 = Four alphanumeric characters (case does not matter).
With this set up the following regular expression should match all combinations.
[A-Z]{3}\d{5}\w{4}
Once you know the commands it is very easy to read.
[A-Z]{3} = Match A to Z three times in a row.
\d{5} = the next five characters are numeric digits.
\w{4}  = the last four characters are alphanumeric characters.
Lastly lets talk about grouping. The regular expression above would match a part number and mark it as group 0. Now you may have to pass that part number onto a web site that requires "XYZ12345" to go into one field and "A1A7" to go into a second field. So you need to mark these as seperate groups. To do this you put the sections in brackets ( ).

So the final regular expression would be...
([A-Z]{3}\d{5})(\w{4})

and there you go! Simple when you know how! :D

Skip to main content link. Accesskey S
IBM Lotus Connections Help Tools About

Tags

A tag is a keyword that is used to categorize an entry. To view the entries with a particular tag, click a tag name or enter a tag in the box.
The tag cloud indicates the frequency of tag use. Popular tags appear darkest. The slider control adjusts how many tags are displayed in the tag cloud.