Guest John L. Posted August 19, 2009 Share Posted August 19, 2009 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 More sharing options...
Ingolme Posted August 19, 2009 Share Posted August 19, 2009 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 More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.