Jump to content

Help Needed With Advanced Regular Expression


Guest John L.
 Share

Recommended Posts

Guest John L.

Here are some basic examples of my data:(1) "5/15/2009 1:18 PM","john_l@noname.net","Created custom s-control: EHTChooser","Custom S-Controls"(2) "5/15/2009 1:20 PM","john_l@noname.net","Deleted custom s-control: EHTChooser","Custom S-Controls" etc.I'm trying to filter the data, using a JavaScript Regular Expression, such that Row (2) remains in the result set, and Row (1) is removed. I'm currently trying the following JavaScript code:

var reDeleted = RegExp('.*[,].*[,]^"Deleted.*[,].*\f');var resultSet = AuditTrail.match(reDeleted);

but the results contains both Rows (1) & (2). How must I change my Regular Expression to accomplish the goal?Thanks in advance for any help you may be able to provide.John L.

Link to comment
Share on other sites

Your expressions are probably being greedy, use ? to prevent that. Also, it's best if you find something else to substitute the . with. A . can take a lot of characters you didn't intend it to. If yu substitute it with something more exact you won't need to worry about greedy expressions.By the way, you don't need square brackets ([]) if you're only testing one character.Try this:

var reDeleted = /[^,]*,[^,]*,"Deleted[^,]*,.*?\f/var resultSet = AuditTrail.match(reDeleted);

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...