NauticalGent
Ignore List Poster Boy
- Local time
- Today, 14:57
- Joined
- Apr 27, 2015
- Messages
- 6,877
Done. Sent a quid pro quo request too!One for me as well please John. Email in my signature line
Done. Sent a quid pro quo request too!One for me as well please John. Email in my signature line
Done!Me too, please. Email in my sig. PM sent. Grazie mille!
need to know where the word IS
intDatePos = RegExPatternStart(Me.txtSubject)
intDateLen = (RegExPatternLen(stFileName, "^(\s|-){0,3}"))
stFileName = Mid(stFileName, intDateLen)
Function RegExPatternStart(strValue As String, Optional PatternText As String, Optional blnCase As Boolean = True, Optional blnBoolean = True) As String
'CHAMATCH
'Get the start position of the pattern within string
'https://stackoverflow.com/questions/8301622/excel-vba-regex-match-position
'Get the length of the pattern within string
'https://developer.rhino3d.com/guides/rhinoscript/vbscript-regexp-objects/
'20190701
Dim objRegEx As Object
Dim strPattern As String
Dim objPosition As Object
Dim strPosition As String
Dim strLength As String
' Create regular expression.
Set objRegEx = CreateObject("VBScript.RegExp")
'objRegEx.Pattern = "[\d]+[\/\-\.][\d]+[\/\-\.][\d]+"
If Len(PatternText) = 0 Then
strPattern = "[\d]+[\/\-\.][\d]+[\/\-\.][\d]+"
Else
strPattern = PatternText
End If
objRegEx.Pattern = strPattern
objRegEx.IgnoreCase = blnCase
' Do the search match.
Set objPosition = objRegEx.Execute(strValue)
strPosition = objPosition(0).FirstIndex
Debug.Print objPosition(0).Value
RegExPatternStart = strPosition
End Function
Function RegExPatternLen(strValue As String, Optional PatternText As String, Optional blnCase As Boolean = True, Optional blnBoolean = True) As String
'CHAMATCH
'Get the start position of the pattern within string
'https://stackoverflow.com/questions/8301622/excel-vba-regex-match-position
'Get the length of the pattern within string
'https://developer.rhino3d.com/guides/rhinoscript/vbscript-regexp-objects/
'20190701
Dim objRegEx As Object
Dim strPattern As String
Dim objPosition As Object
Dim strPosition As String
Dim strLength As String
' Create regular expression.
Set objRegEx = CreateObject("VBScript.RegExp")
'objRegEx.Pattern = "[\d]+[\/\-\.][\d]+[\/\-\.][\d]+"
If Len(PatternText) = 0 Then
strPattern = "[\d]+[\/\-\.][\d]+[\/\-\.][\d]+"
Else
strPattern = PatternText
End If
objRegEx.Pattern = strPattern
objRegEx.IgnoreCase = blnCase
' Do the search match.
Set objPosition = objRegEx.Execute(strValue)
strLength = objPosition(0).Length
RegExPatternLen = strLength + 1
End Function
Private Sub t()
Dim label As String
Dim textbox As String
Dim class As String
label = "arnel "
textbox = "gp"
class = label & textbox
Debug.Print class
End Sub
very nice, can't wait to test it.
there is minor glitch.
people new to access doesn't know to avoid reserved words
on their code
@strive4peace very nice.
It may be too much of a request. But is it possible to allow dragging and changing the size of codeOrig? I know it's not a native behavior for Access text boxes, just thought you may have ideas on that.
I'd forgotten about this. ThanksYou can press SHIFT-F2 for the Zoom box when looking at a value, which can be resized and formatted
thanks, Tera
sPattern = "^([^\" & Chr(34) & "])*[\'](.)*"
If Trim(p & "") = "" Then Exit Function
With CreateObject("VBScript.RegExp")
.Global = True
.IgnoreCase = True
.Pattern = sPattern
Debug.Print .test(p) '<== it will return True if it the line
' has spaces and single (') + other text(or no text after) OR
' begins with (') + other text(or no text after).
End With
Hi Crystal (@strive4peace). Just playing with it some more, I was able to extract more information about each match that maybe you can use to figure out the characters that failed the match.Now that I see how to get the words with Regular Expressions (thanks theDBguy especially, I would love to know ... perhaps there is a way to return the entire substring that was tested? with the outside text that wasn't counted in the word? ... and can I specify a replacement phrase in the regular expression? Small words like IN are everywhere!
In contrast, the above image was using the pattern: "\b\w+\b", while this one below is using the pattern: "\W"Hi Crystal (@strive4peace). Just playing with it some more, I was able to extract more information about each match that maybe you can use to figure out the characters that failed the match.
View attachment 81684
Ah, so by combining both patterns as: "\b\w+\b\W", I got this. Maybe, this is what you wanted?In contrast, the above image was using the pattern: "\b\w+\b", while this one below is using the pattern: "\W"
View attachment 81687