Solved Regular Expression to detect end of word (1 Viewer)

theDBguy

I’m here to help
Staff member
Local time
Today, 11:10
Joined
Oct 29, 2018
Messages
21,494
In contrast, the above image was using the pattern: "\b\w+\b", while this one below is using the pattern: "\W"

View attachment 81687
Ah, so by combining both patterns as: "\b\w+\b\W", I got this. Maybe, this is what you wanted?

combined.png
 

strive4peace

AWF VIP
Local time
Today, 13:10
Joined
Apr 3, 2020
Messages
1,002
thanks theDBguy. I thought of a better way (right now, there are cases where double quotes are going to mess up getting the right position for comment) to get comment. Spent a little time rearranging tables and fields to prepare for other comparisons, so when I get that done, which won't be real soon since it will take a couple more days I don't have right now.

I'm confused though... \b is backspace, right? I'm not understanding the logic of the pattern ...

Anyway, I explored the RegExp object model and here are some notes:

WhatTypeNameTypeSyntax
RegExpMExecuteobjectExecute(sourceString As String) As Object
RegExpPGlobalBoolean
RegExpPIgnoreCaseBoolean
RegExpPMultilineBoolean
RegExpPPatternString
RegExpMReplaceStringReplace(sourceString As String, replaceVar) As String
RegExpMTestBooleanTest(sourceString As String) As Boolean
MatchPFirstIndex Long
MatchPLength Long
MatchPoSubMatches object
MatchPValueString
MatchCollectionPCountLong
MatchCollectionPoItemobjectItem(index As Long) As Object
SubMatchesPCountLong
SubMatchesPoItemobjectItem(index As Long) As Object

If I can find a graceful way to use RegExp then I will use it, but right now, I'm leaning toward processing everything in one loop, without it, now that I thought of things that didn't occur to me before.

This actually works fine for how I use it... but of course, I see ways to make it better, like to mark reserved words and maybe functions too (if I can find my list. At one time I went through all the choices in the Expression Builder, which I know isn't complete, but also made some modifications)

thanks again!
 

theDBguy

I’m here to help
Staff member
Local time
Today, 11:10
Joined
Oct 29, 2018
Messages
21,494
thanks theDBguy. I thought of a better way (right now, there are cases where double quotes are going to mess up getting the right position for comment) to get comment. Spent a little time rearranging tables and fields to prepare for other comparisons, so when I get that done, which won't be real soon since it will take a couple more days I don't have right now.

I'm confused though... \b is backspace, right? I'm not understanding the logic of the pattern ...

Anyway, I explored the RegExp object model and here are some notes:

WhatTypeNameTypeSyntax
RegExpMExecuteobjectExecute(sourceString As String) As Object
RegExpPGlobalBoolean
RegExpPIgnoreCaseBoolean
RegExpPMultilineBoolean
RegExpPPatternString
RegExpMReplaceStringReplace(sourceString As String, replaceVar) As String
RegExpMTestBooleanTest(sourceString As String) As Boolean
MatchPFirstIndexLong
MatchPLengthLong
MatchPoSubMatchesobject
MatchPValueString
MatchCollectionPCountLong
MatchCollectionPoItemobjectItem(index As Long) As Object
SubMatchesPCountLong
SubMatchesPoItemobjectItem(index As Long) As Object

If I can find a graceful way to use RegExp then I will use it, but right now, I'm leaning toward processing everything in one loop, without it, now that I thought of things that didn't occur to me before.

This actually works fine for how I use it... but of course, I see ways to make it better, like to mark reserved words and maybe functions too (if I can find my list. At one time I went through all the choices in the Expression Builder, which I know isn't complete, but also made some modifications)

thanks again!
Hi Crystal (@strive4peace). No, \b means a word "boundary," not a backspace.
 

Users who are viewing this thread

Top Bottom