Pattern = "\.(?![A-Z]{2})"
Replacement = ""
m = Regex.Matcher(Pattern, Text)
Dim r As Reflector
r.Target = m
Text = r.RunMethod2("replaceAll", Replacement, "java.lang.String")
Regex.Replace("\.(?![A-Z]{2})", Text, " $")
text = Regex.Replace("\.(?![A-Z]{2})", Text, " $")
Dim psString As String = "I'm in the U.S. not the U.S.S.R."
Dim psStripped As String = psString.Replace(".", " ")
Dim psPattern As String = "[\\s.]" 'Same results as "\.(?![A-Z]{2})" just simpler
Log("Repl Stripped: " & psStripped)
psStripped = Regex.Replace(psPattern, psString, " ")
Log("Regx Stripped: " & psStripped)
Dim poMatch As Matcher = Regex.Matcher(psPattern, psString)
Dim r As Reflector
r.Target = poMatch
Log("Refl Stripped: " & r.RunMethod2("replaceAll", " ", "java.lang.String"))
Repl Stripped: I'm in the U S not the U S S R
Regx Stripped: I'm in the U S not the U S S R
Refl Stripped: I'm in the U S not the U S S R
I can't use any of those because of the end of sentence period.
Dim psString As String = "I'm in the U.S. not the U.S.S.R."
Dim psStripped As String = psString.SubString2(0, psString.LastIndexOf(".")).Replace(".", " ") & "."
Dim psPattern As String = "\.(?=.*\.)"
Log("Repl Stripped: " & psStripped)
psStripped = Regex.Replace(psPattern, psString, " ")
Log("Regx Stripped: " & psStripped)
Dim poMatch As Matcher = Regex.Matcher(psPattern, psString)
Dim r As Reflector
r.Target = poMatch
Log("Refl Stripped: " & r.RunMethod2("replaceAll", " ", "java.lang.String"))
Repl Stripped: I'm in the U S not the U S S R.
Regx Stripped: I'm in the U S not the U S S R.
Refl Stripped: I'm in the U S not the U S S R.
One of my favorite comics:i think it's unrealistic to believe that everything can be reduced to a 1-liner (if for no other reason than it becomes a maintenance nightmare should yet another
exception to some rule be discovered.) and there is no law that an abbreviation can't have more than 1 meaning, or that a sentence can't end with an abbreviation. big jobs are often best broken into smaller jobs.
HELLO CSECT The name of this program is 'HELLO'
* Register 15 points here on entry from OPSYS or caller.
STM 14,12,12(13) Save registers 14,15, and 0 thru 12 in caller's Save area
LR 12,15 Set up base register with program's entry point address
USING HELLO,12 Tell assembler which register we are using for pgm. base
LA 15,SAVE Now Point at our own save area
ST 15,8(13) Set forward chain
ST 13,4(15) Set back chain
LR 13,15 Set R13 to address of new save area
* -end of housekeeping (similar for most programs) -
WTO 'Hello World' Write To Operator (Operating System macro)
*
L 13,4(13) restore address to caller-provided save area
XC 8(4,13),8(13) Clear forward chain
LM 14,12,12(13) Restore registers as on entry
DROP 12 The opposite of 'USING'
SR 15,15 Set register 15 to 0 so that the return code (R15) is Zero
BR 14 Return to caller
*
SAVE DS 18F Define 18 fullwords to save calling program registers
END HELLO This is the end of the program
I never said I didn't program in mainframe assembler, heck I even wrote some low-level drivers for an early piece of digital camera equipment in 8086 assembler on a windows 95 machine. I just don't like assembly programmingJeffrey, sorry but you can't compare COBOL to Assembler.
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?
We use cookies and similar technologies for the following purposes:
Do you accept cookies and these technologies?