Regex11 bug?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Regex11 bug?

Boris Popov, DeepCove Labs (SNN)

 

'1234.5.6' matchesRegex: '[\d\.]+'

 

Unhandled exception: bad backslash escape

RxParser class>>signalSyntaxException:

optimized [] in RxsPredicate class>>forEscapedLetter:

Dictionary>>at:ifAbsent:

RxsPredicate class>>forEscapedLetter:

RxCharSetParser>>parseEscapeChar

RxCharSetParser>>parseStep

RxCharSetParser>>parse

RxParser>>characterSetFrom:

RxParser>>characterSet

RxParser>>atom

RxParser>>piece

RxParser>>branch

RxParser>>regex

RxParser>>parseStream:

RxParser>>parse:

ByteString(CharacterArray)>>asRegex

ByteString(CharacterArray)>>matchesRegex:

UndefinedObject>>unboundMethod

UndefinedObject(Object)>>performMethod:arguments:

UndefinedObject(Object)>>performMethod:

TextEditorController(ParagraphEditor)>>evaluateCompiled:

optimized [] in ParagraphEditor>>evaluateSelection

BlockClosure>>ensure:

Cursor>>showWhile:

TextEditorController(ParagraphEditor)>>evaluateSelection

optimized [] in ParagraphEditor>>doIt

BlockClosure>>on:do:

TextEditorController(ParagraphEditor)>>doIt

TextEditorController>>dispatchMenuSymbol:

TextEditorController>>dispatchMenuSelection:

TextEditorController(ControllerWithMenu)>>processMenu:at:centered:

TextEditorController(ControllerWithMenu)>>processMenuAt:centered:

TextEditorController(ControllerWithMenu)>>yellowButtonPressedEvent:

TextEditorController(ParagraphEditor)>>yellowButtonPressedEvent:

TextEditorController>>yellowButtonPressedEvent:

YellowButtonPressedEvent>>dispatchTo:

TextEditorController(ControllerWithMenu)>>handleEvent:

EventDispatcher>>dispatch:to:

EventDispatcher>>dispatchEvent:

YellowButtonPressedEvent(Event)>>dispatch

YellowButtonPressedEvent(Event)>>dispatchForWindowManager:

optimized [] in WindowManager>>safelyDispatchForWindowManager:

BlockClosure>>on:do:

WindowManager>>safelyDispatchForWindowManager:

WindowManager>>processNextEvent

optimized [] in [] in WindowManager>>newProcess

BlockClosure>>on:do:

optimized [] in WindowManager>>newProcess

BlockClosure>>on:do:

optimized [] in Process class>>forBlock:priority:

 

----------------------------------------------------------------------

RxParser class>>signalSyntaxException:

Receiver:

                a RxParser class

Instance Variables:

                superclass = Object

                methodDict = a MethodDictionary[16]

                format = 16386

                subclasses = nil

                instanceVariables = an Array[2]

                organization = ('private' #characterSetFrom: #ifSpecial:then: #inputUpTo:errorMessage: #inputUpTo:nestedOn:errorMessage: #match: #next #signalParseError #signalParseError:)

('recursive descent' #atom #branch #characterSet #messagePredicate #piece #regex)

('accessing' #parse: #parseStream:)

 

                name = #RxParser

                classPool = a NameSpaceOfClass[3]

                environment = nil

Arguments:

                errorString = 'bad backslash escape'

Context PC = 6

 

----------------------------------------------------------------------

optimized [] in RxsPredicate class>>forEscapedLetter:

Receiver:

                an UndefinedObject

Context PC = 4

 

----------------------------------------------------------------------

Dictionary>>at:ifAbsent:

Receiver:

                a Dictionary

Instance Variables:

                tally = 7

Arguments:

                key = $. "16r002E"

                aBlock = BlockClosure [] in RxsPredicate class>>forEscapedLetter:

Temporaries:

                index = 13

                obj = nil

Context PC = 17

 

----------------------------------------------------------------------

RxsPredicate class>>forEscapedLetter:

Receiver:

                a RxsPredicate class

Instance Variables:

                superclass = RxsNode

                methodDict = a MethodDictionary[24]

                format = 16386

                subclasses = nil

                instanceVariables = an Array[2]

                organization = ('initialize-release' #beAlphaNumeric #beAlphabetic #beBackslash #beControl #beDigit #beGraphics #beHexDigit #beLowercase #beNotDigit #beNotSpace #beNotWordConstituent #bePrintable #bePunctuation #beSpace #beUppercase #beWordConstituent)

('accessing' #dispatchTo: #negated #predicate #predicateNegation #value:)

('testing' #isAtomic #isEnumerable)

('private' #negate)

 

                name = #RxsPredicate

                classPool = a NameSpaceOfClass[2]

                environment = nil

Arguments:

                aCharacter = $. "16r002E"

Context PC = 9

 

----------------------------------------------------------------------

RxCharSetParser>>parseEscapeChar

Receiver:

                a RxCharSetParser

Instance Variables:

                source = a ReadStream

                lookahead = $. "16r002E"

                elements = an OrderedCollection[1]

Context PC = 28

 

----------------------------------------------------------------------

RxCharSetParser>>parseStep

Receiver:

                a RxCharSetParser

Instance Variables:

                source = a ReadStream

                lookahead = $. "16r002E"

                elements = an OrderedCollection[1]

Context PC = 29

 

----------------------------------------------------------------------

RxCharSetParser>>parse

Receiver:

                a RxCharSetParser

Instance Variables:

                source = a ReadStream

                lookahead = $. "16r002E"

                elements = an OrderedCollection[1]

Context PC = 26

 

----------------------------------------------------------------------

RxParser>>characterSetFrom:

Receiver:

                a RxParser

Instance Variables:

                input = a ReadStream

                lookahead = $] "16r005D"

Arguments:

                setSpec = '\d\.'

Temporaries:

                negated = false

                spec = a ReadStream

Context PC = 28

 

----------------------------------------------------------------------

RxParser>>characterSet

Receiver:

                a RxParser

Instance Variables:

                input = a ReadStream

                lookahead = $] "16r005D"

Temporaries:

                spec = '\d\.'

                errorMessage = ' no terminating "]"'

Context PC = 43

 

----------------------------------------------------------------------

RxParser>>atom

Receiver:

                a RxParser

Instance Variables:

                input = a ReadStream

                lookahead = $] "16r005D"

Temporaries:

                atom = nil

Context PC = 83

 

----------------------------------------------------------------------

RxParser>>piece

Receiver:

                a RxParser

Instance Variables:

                input = a ReadStream

                lookahead = $] "16r005D"

Temporaries:

                atom = nil

                errorMessage = ' nullable closure'

Context PC = 6

 

----------------------------------------------------------------------

RxParser>>branch

Receiver:

                a RxParser

Instance Variables:

                input = a ReadStream

                lookahead = $] "16r005D"

Temporaries:

                piece = nil

                branch = nil

Context PC = 4

 

----------------------------------------------------------------------

RxParser>>regex

Receiver:

                a RxParser

Instance Variables:

                input = a ReadStream

                lookahead = $] "16r005D"

Temporaries:

                branch = nil

                regex = nil

Context PC = 4

 

----------------------------------------------------------------------

RxParser>>parseStream:

Receiver:

                a RxParser

Instance Variables:

                input = a ReadStream

                lookahead = $] "16r005D"

Arguments:

                aStream = a ReadStream

Temporaries:

                tree = nil

Context PC = 12

 

----------------------------------------------------------------------

RxParser>>parse:

Receiver:

                a RxParser

Instance Variables:

                input = a ReadStream

                lookahead = $] "16r005D"

Arguments:

                aString = '[\d\.]+'

Context PC = 8

 

----------------------------------------------------------------------

ByteString(CharacterArray)>>asRegex

Receiver:

                a ByteString

Context PC = 7

 

----------------------------------------------------------------------

ByteString(CharacterArray)>>matchesRegex:

Receiver:

                a ByteString

Arguments:

                regexString = '[\d\.]+'

Context PC = 3

 

-Boris

Sr. Software Engineer

DeepCove Labs

4th floor, 595 Howe Street

Vancouver, BC V6C 2T5

Canada

 


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: Regex11 bug?

Karsten Kusche
Hi Boris,

as far as I understand Regex, the blocks: [ ] only contain characters or such. So if you have a . in there, this would already be the character . so you don't need to escape it there. If you use [\d.]+ then it works.

Karsten



-- 
Karsten Kusche - Dipl. Inf. - [hidden email]
Georg Heeg eK - Köthen
Handelsregister: Amtsgericht Dortmund A 12812 

Am Montag, 9. Juli 2012 um 16:28 schrieb Boris Popov, DeepCove Labs:

 

'1234.5.6' matchesRegex: '[\d\.]+'

 

Unhandled exception: bad backslash escape

RxParser class>>signalSyntaxException:

optimized [] in RxsPredicate class>>forEscapedLetter:

Dictionary>>at:ifAbsent:

RxsPredicate class>>forEscapedLetter:

RxCharSetParser>>parseEscapeChar

RxCharSetParser>>parseStep

RxCharSetParser>>parse

RxParser>>characterSetFrom:

RxParser>>characterSet

RxParser>>atom

RxParser>>piece

RxParser>>branch

RxParser>>regex

RxParser>>parseStream:

RxParser>>parse:

ByteString(CharacterArray)>>asRegex

ByteString(CharacterArray)>>matchesRegex:

UndefinedObject>>unboundMethod

UndefinedObject(Object)>>performMethod:arguments:

UndefinedObject(Object)>>performMethod:

TextEditorController(ParagraphEditor)>>evaluateCompiled:

optimized [] in ParagraphEditor>>evaluateSelection

BlockClosure>>ensure:

Cursor>>showWhile:

TextEditorController(ParagraphEditor)>>evaluateSelection

optimized [] in ParagraphEditor>>doIt

BlockClosure>>on:do:

TextEditorController(ParagraphEditor)>>doIt

TextEditorController>>dispatchMenuSymbol:

TextEditorController>>dispatchMenuSelection:

TextEditorController(ControllerWithMenu)>>processMenu:at:centered:

TextEditorController(ControllerWithMenu)>>processMenuAt:centered:

TextEditorController(ControllerWithMenu)>>yellowButtonPressedEvent:

TextEditorController(ParagraphEditor)>>yellowButtonPressedEvent:

TextEditorController>>yellowButtonPressedEvent:

YellowButtonPressedEvent>>dispatchTo:

TextEditorController(ControllerWithMenu)>>handleEvent:

EventDispatcher>>dispatch:to:

EventDispatcher>>dispatchEvent:

YellowButtonPressedEvent(Event)>>dispatch

YellowButtonPressedEvent(Event)>>dispatchForWindowManager:

optimized [] in WindowManager>>safelyDispatchForWindowManager:

BlockClosure>>on:do:

WindowManager>>safelyDispatchForWindowManager:

WindowManager>>processNextEvent

optimized [] in [] in WindowManager>>newProcess

BlockClosure>>on:do:

optimized [] in WindowManager>>newProcess

BlockClosure>>on:do:

optimized [] in Process class>>forBlock:priority:

 

----------------------------------------------------------------------

RxParser class>>signalSyntaxException:

Receiver:

                a RxParser class

Instance Variables:

                superclass = Object

                methodDict = a MethodDictionary[16]

                format = 16386

                subclasses = nil

                instanceVariables = an Array[2]

                organization = ('private' #characterSetFrom: #ifSpecial:then: #inputUpTo:errorMessage: #inputUpTo:nestedOn:errorMessage: #match: #next #signalParseError #signalParseError:)

('recursive descent' #atom #branch #characterSet #messagePredicate #piece #regex)

('accessing' #parse: #parseStream:)

 

                name = #RxParser

                classPool = a NameSpaceOfClass[3]

                environment = nil

Arguments:

                errorString = 'bad backslash escape'

Context PC = 6

 

----------------------------------------------------------------------

optimized [] in RxsPredicate class>>forEscapedLetter:

Receiver:

                an UndefinedObject

Context PC = 4

 

----------------------------------------------------------------------

Dictionary>>at:ifAbsent:

Receiver:

                a Dictionary

Instance Variables:

                tally = 7

Arguments:

                key = $. "16r002E"

                aBlock = BlockClosure [] in RxsPredicate class>>forEscapedLetter:

Temporaries:

                index = 13

                obj = nil

Context PC = 17

 

----------------------------------------------------------------------

RxsPredicate class>>forEscapedLetter:

Receiver:

                a RxsPredicate class

Instance Variables:

                superclass = RxsNode

                methodDict = a MethodDictionary[24]

                format = 16386

                subclasses = nil

                instanceVariables = an Array[2]

                organization = ('initialize-release' #beAlphaNumeric #beAlphabetic #beBackslash #beControl #beDigit #beGraphics #beHexDigit #beLowercase #beNotDigit #beNotSpace #beNotWordConstituent #bePrintable #bePunctuation #beSpace #beUppercase #beWordConstituent)

('accessing' #dispatchTo: #negated #predicate #predicateNegation #value:)

('testing' #isAtomic #isEnumerable)

('private' #negate)

 

                name = #RxsPredicate

                classPool = a NameSpaceOfClass[2]

                environment = nil

Arguments:

                aCharacter = $. "16r002E"

Context PC = 9

 

----------------------------------------------------------------------

RxCharSetParser>>parseEscapeChar

Receiver:

                a RxCharSetParser

Instance Variables:

                source = a ReadStream

                lookahead = $. "16r002E"

                elements = an OrderedCollection[1]

Context PC = 28

 

----------------------------------------------------------------------

RxCharSetParser>>parseStep

Receiver:

                a RxCharSetParser

Instance Variables:

                source = a ReadStream

                lookahead = $. "16r002E"

                elements = an OrderedCollection[1]

Context PC = 29

 

----------------------------------------------------------------------

RxCharSetParser>>parse

Receiver:

                a RxCharSetParser

Instance Variables:

                source = a ReadStream

                lookahead = $. "16r002E"

                elements = an OrderedCollection[1]

Context PC = 26

 

----------------------------------------------------------------------

RxParser>>characterSetFrom:

Receiver:

                a RxParser

Instance Variables:

                input = a ReadStream

                lookahead = $] "16r005D"

Arguments:

                setSpec = '\d\.'

Temporaries:

                negated = false

                spec = a ReadStream

Context PC = 28

 

----------------------------------------------------------------------

RxParser>>characterSet

Receiver:

                a RxParser

Instance Variables:

                input = a ReadStream

                lookahead = $] "16r005D"

Temporaries:

                spec = '\d\.'

                errorMessage = ' no terminating "]"'

Context PC = 43

 

----------------------------------------------------------------------

RxParser>>atom

Receiver:

                a RxParser

Instance Variables:

                input = a ReadStream

                lookahead = $] "16r005D"

Temporaries:

                atom = nil

Context PC = 83

 

----------------------------------------------------------------------

RxParser>>piece

Receiver:

                a RxParser

Instance Variables:

                input = a ReadStream

                lookahead = $] "16r005D"

Temporaries:

                atom = nil

                errorMessage = ' nullable closure'

Context PC = 6

 

----------------------------------------------------------------------

RxParser>>branch

Receiver:

                a RxParser

Instance Variables:

                input = a ReadStream

                lookahead = $] "16r005D"

Temporaries:

                piece = nil

                branch = nil

Context PC = 4

 

----------------------------------------------------------------------

RxParser>>regex

Receiver:

                a RxParser

Instance Variables:

                input = a ReadStream

                lookahead = $] "16r005D"

Temporaries:

                branch = nil

                regex = nil

Context PC = 4

 

----------------------------------------------------------------------

RxParser>>parseStream:

Receiver:

                a RxParser

Instance Variables:

                input = a ReadStream

                lookahead = $] "16r005D"

Arguments:

                aStream = a ReadStream

Temporaries:

                tree = nil

Context PC = 12

 

----------------------------------------------------------------------

RxParser>>parse:

Receiver:

                a RxParser

Instance Variables:

                input = a ReadStream

                lookahead = $] "16r005D"

Arguments:

                aString = '[\d\.]+'

Context PC = 8

 

----------------------------------------------------------------------

ByteString(CharacterArray)>>asRegex

Receiver:

                a ByteString

Context PC = 7

 

----------------------------------------------------------------------

ByteString(CharacterArray)>>matchesRegex:

Receiver:

                a ByteString

Arguments:

                regexString = '[\d\.]+'

Context PC = 3

 

-Boris

Sr. Software Engineer

DeepCove Labs

4th floor, 595 Howe Street

Vancouver, BC V6C 2T5

Canada

 

_______________________________________________
vwnc mailing list


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: Regex11 bug?

Boris Popov, DeepCove Labs (SNN)

Karsten,

 

Duh, okay, thanks!

 

-Boris

 

From: Karsten Kusche [mailto:[hidden email]]
Sent: Monday, July 09, 2012 10:38 AM
To: Boris Popov, DeepCove Labs
Cc: VWNC NC
Subject: Re: [vwnc] Regex11 bug?

 

Hi Boris,

 

as far as I understand Regex, the blocks: [ ] only contain characters or such. So if you have a . in there, this would already be the character . so you don't need to escape it there. If you use [\d.]+ then it works.

 

Karsten

 

 

 

-- 

Karsten Kusche - Dipl. Inf. - [hidden email]

Georg Heeg eK - Köthen

Handelsregister: Amtsgericht Dortmund A 12812 

 

Am Montag, 9. Juli 2012 um 16:28 schrieb Boris Popov, DeepCove Labs:

 

'1234.5.6' matchesRegex: '[\d\.]+'

 

Unhandled exception: bad backslash escape

RxParser class>>signalSyntaxException:

optimized [] in RxsPredicate class>>forEscapedLetter:

Dictionary>>at:ifAbsent:

RxsPredicate class>>forEscapedLetter:

RxCharSetParser>>parseEscapeChar

RxCharSetParser>>parseStep

RxCharSetParser>>parse

RxParser>>characterSetFrom:

RxParser>>characterSet

RxParser>>atom

RxParser>>piece

RxParser>>branch

RxParser>>regex

RxParser>>parseStream:

RxParser>>parse:

ByteString(CharacterArray)>>asRegex

ByteString(CharacterArray)>>matchesRegex:

UndefinedObject>>unboundMethod

UndefinedObject(Object)>>performMethod:arguments:

UndefinedObject(Object)>>performMethod:

TextEditorController(ParagraphEditor)>>evaluateCompiled:

optimized [] in ParagraphEditor>>evaluateSelection

BlockClosure>>ensure:

Cursor>>showWhile:

TextEditorController(ParagraphEditor)>>evaluateSelection

optimized [] in ParagraphEditor>>doIt

BlockClosure>>on:do:

TextEditorController(ParagraphEditor)>>doIt

TextEditorController>>dispatchMenuSymbol:

TextEditorController>>dispatchMenuSelection:

TextEditorController(ControllerWithMenu)>>processMenu:at:centered:

TextEditorController(ControllerWithMenu)>>processMenuAt:centered:

TextEditorController(ControllerWithMenu)>>yellowButtonPressedEvent:

TextEditorController(ParagraphEditor)>>yellowButtonPressedEvent:

TextEditorController>>yellowButtonPressedEvent:

YellowButtonPressedEvent>>dispatchTo:

TextEditorController(ControllerWithMenu)>>handleEvent:

EventDispatcher>>dispatch:to:

EventDispatcher>>dispatchEvent:

YellowButtonPressedEvent(Event)>>dispatch

YellowButtonPressedEvent(Event)>>dispatchForWindowManager:

optimized [] in WindowManager>>safelyDispatchForWindowManager:

BlockClosure>>on:do:

WindowManager>>safelyDispatchForWindowManager:

WindowManager>>processNextEvent

optimized [] in [] in WindowManager>>newProcess

BlockClosure>>on:do:

optimized [] in WindowManager>>newProcess

BlockClosure>>on:do:

optimized [] in Process class>>forBlock:priority:

 

----------------------------------------------------------------------

RxParser class>>signalSyntaxException:

Receiver:

                a RxParser class

Instance Variables:

                superclass = Object

                methodDict = a MethodDictionary[16]

                format = 16386

                subclasses = nil

                instanceVariables = an Array[2]

                organization = ('private' #characterSetFrom: #ifSpecial:then: #inputUpTo:errorMessage: #inputUpTo:nestedOn:errorMessage: #match: #next #signalParseError #signalParseError:)

('recursive descent' #atom #branch #characterSet #messagePredicate #piece #regex)

('accessing' #parse: #parseStream:)

 

                name = #RxParser

                classPool = a NameSpaceOfClass[3]

                environment = nil

Arguments:

                errorString = 'bad backslash escape'

Context PC = 6

 

----------------------------------------------------------------------

optimized [] in RxsPredicate class>>forEscapedLetter:

Receiver:

                an UndefinedObject

Context PC = 4

 

----------------------------------------------------------------------

Dictionary>>at:ifAbsent:

Receiver:

                a Dictionary

Instance Variables:

                tally = 7

Arguments:

                key = $. "16r002E"

                aBlock = BlockClosure [] in RxsPredicate class>>forEscapedLetter:

Temporaries:

                index = 13

                obj = nil

Context PC = 17

 

----------------------------------------------------------------------

RxsPredicate class>>forEscapedLetter:

Receiver:

                a RxsPredicate class

Instance Variables:

                superclass = RxsNode

                methodDict = a MethodDictionary[24]

                format = 16386

                subclasses = nil

                instanceVariables = an Array[2]

                organization = ('initialize-release' #beAlphaNumeric #beAlphabetic #beBackslash #beControl #beDigit #beGraphics #beHexDigit #beLowercase #beNotDigit #beNotSpace #beNotWordConstituent #bePrintable #bePunctuation #beSpace #beUppercase #beWordConstituent)

('accessing' #dispatchTo: #negated #predicate #predicateNegation #value:)

('testing' #isAtomic #isEnumerable)

('private' #negate)

 

                name = #RxsPredicate

                classPool = a NameSpaceOfClass[2]

                environment = nil

Arguments:

                aCharacter = $. "16r002E"

Context PC = 9

 

----------------------------------------------------------------------

RxCharSetParser>>parseEscapeChar

Receiver:

                a RxCharSetParser

Instance Variables:

                source = a ReadStream

                lookahead = $. "16r002E"

                elements = an OrderedCollection[1]

Context PC = 28

 

----------------------------------------------------------------------

RxCharSetParser>>parseStep

Receiver:

                a RxCharSetParser

Instance Variables:

                source = a ReadStream

                lookahead = $. "16r002E"

                elements = an OrderedCollection[1]

Context PC = 29

 

----------------------------------------------------------------------

RxCharSetParser>>parse

Receiver:

                a RxCharSetParser

Instance Variables:

                source = a ReadStream

                lookahead = $. "16r002E"

                elements = an OrderedCollection[1]

Context PC = 26

 

----------------------------------------------------------------------

RxParser>>characterSetFrom:

Receiver:

                a RxParser

Instance Variables:

                input = a ReadStream

                lookahead = $] "16r005D"

Arguments:

                setSpec = '\d\.'

Temporaries:

                negated = false

                spec = a ReadStream

Context PC = 28

 

----------------------------------------------------------------------

RxParser>>characterSet

Receiver:

                a RxParser

Instance Variables:

                input = a ReadStream

                lookahead = $] "16r005D"

Temporaries:

                spec = '\d\.'

                errorMessage = ' no terminating "]"'

Context PC = 43

 

----------------------------------------------------------------------

RxParser>>atom

Receiver:

                a RxParser

Instance Variables:

                input = a ReadStream

                lookahead = $] "16r005D"

Temporaries:

                atom = nil

Context PC = 83

 

----------------------------------------------------------------------

RxParser>>piece

Receiver:

                a RxParser

Instance Variables:

                input = a ReadStream

                lookahead = $] "16r005D"

Temporaries:

                atom = nil

                errorMessage = ' nullable closure'

Context PC = 6

 

----------------------------------------------------------------------

RxParser>>branch

Receiver:

                a RxParser

Instance Variables:

                input = a ReadStream

                lookahead = $] "16r005D"

Temporaries:

                piece = nil

                branch = nil

Context PC = 4

 

----------------------------------------------------------------------

RxParser>>regex

Receiver:

                a RxParser

Instance Variables:

                input = a ReadStream

                lookahead = $] "16r005D"

Temporaries:

                branch = nil

                regex = nil

Context PC = 4

 

----------------------------------------------------------------------

RxParser>>parseStream:

Receiver:

                a RxParser

Instance Variables:

                input = a ReadStream

                lookahead = $] "16r005D"

Arguments:

                aStream = a ReadStream

Temporaries:

                tree = nil

Context PC = 12

 

----------------------------------------------------------------------

RxParser>>parse:

Receiver:

                a RxParser

Instance Variables:

                input = a ReadStream

                lookahead = $] "16r005D"

Arguments:

                aString = '[\d\.]+'

Context PC = 8

 

----------------------------------------------------------------------

ByteString(CharacterArray)>>asRegex

Receiver:

                a ByteString

Context PC = 7

 

----------------------------------------------------------------------

ByteString(CharacterArray)>>matchesRegex:

Receiver:

                a ByteString

Arguments:

                regexString = '[\d\.]+'

Context PC = 3

 

-Boris

Sr. Software Engineer

DeepCove Labs

4th floor, 595 Howe Street

Vancouver, BC V6C 2T5

Canada

 

_______________________________________________

vwnc mailing list

 


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: Regex11 bug?

Conrad Taylor
In reply to this post by Karsten Kusche
On Mon, Jul 9, 2012 at 7:38 AM, Karsten Kusche <[hidden email]> wrote:
Hi Boris,

as far as I understand Regex, the blocks: [ ] only contain characters or such. So if you have a . in there, this would already be the character . so you don't need to escape it there. If you use [\d.]+ then it works.

Karsten



Karsten, should it really generate a nasty message like the below?  I'm guessing that one should be able to put any legal syntax within the [] and it would match or not match.  For example, if the Regex library supports the PCRE standard which is probably the case, then one should theoretically obtain a consistent result using different languages as can be seen below:

Ruby (regex.rb):

regex = /[\d\.]+/

strings = %w[ 1234, 1234.5, 1234.5.6, 1234.5.6..7 ]

strings.each do | string |
  if string =~ regex
    puts "#{string} is a match"
  else
    puts "#{string} isn't a match"
  end
end

OUTPUT:

$ ruby regex.rb
1234, is a match
1234.5, is a match
1234.5.6, is a match
1234.5.6..7 is a match

Perl (regex.pl):

$regex = /[\d\.]+/;

@strings = qw( 1234, 1234.5, 1234.5.6, 1234.5.6..7 );

foreach (@strings) {
  if ($_ =~ $regex) {
    print "$_ is a match\n";
  } 
  else {
    print "$_ isn't a match\n"
  }
}

OUTPUT:

$ perl regex,pl
1234, is a match
1234.5, is a match
1234.5.6, is a match
1234.5.6..7 is a match
 

-- 
Karsten Kusche - Dipl. Inf. - [hidden email]
Georg Heeg eK - Köthen
Handelsregister: Amtsgericht Dortmund A 12812 

Am Montag, 9. Juli 2012 um 16:28 schrieb Boris Popov, DeepCove Labs:

 

'1234.5.6' matchesRegex: '[\d\.]+'

 

Unhandled exception: bad backslash escape

RxParser class>>signalSyntaxException:

optimized [] in RxsPredicate class>>forEscapedLetter:

Dictionary>>at:ifAbsent:

RxsPredicate class>>forEscapedLetter:

RxCharSetParser>>parseEscapeChar

RxCharSetParser>>parseStep

RxCharSetParser>>parse

RxParser>>characterSetFrom:

RxParser>>characterSet

RxParser>>atom

RxParser>>piece

RxParser>>branch

RxParser>>regex

RxParser>>parseStream:

RxParser>>parse:

ByteString(CharacterArray)>>asRegex

ByteString(CharacterArray)>>matchesRegex:

UndefinedObject>>unboundMethod

UndefinedObject(Object)>>performMethod:arguments:

UndefinedObject(Object)>>performMethod:

TextEditorController(ParagraphEditor)>>evaluateCompiled:

optimized [] in ParagraphEditor>>evaluateSelection

BlockClosure>>ensure:

Cursor>>showWhile:

TextEditorController(ParagraphEditor)>>evaluateSelection

optimized [] in ParagraphEditor>>doIt

BlockClosure>>on:do:

TextEditorController(ParagraphEditor)>>doIt

TextEditorController>>dispatchMenuSymbol:

TextEditorController>>dispatchMenuSelection:

TextEditorController(ControllerWithMenu)>>processMenu:at:centered:

TextEditorController(ControllerWithMenu)>>processMenuAt:centered:

TextEditorController(ControllerWithMenu)>>yellowButtonPressedEvent:

TextEditorController(ParagraphEditor)>>yellowButtonPressedEvent:

TextEditorController>>yellowButtonPressedEvent:

YellowButtonPressedEvent>>dispatchTo:

TextEditorController(ControllerWithMenu)>>handleEvent:

EventDispatcher>>dispatch:to:

EventDispatcher>>dispatchEvent:

YellowButtonPressedEvent(Event)>>dispatch

YellowButtonPressedEvent(Event)>>dispatchForWindowManager:

optimized [] in WindowManager>>safelyDispatchForWindowManager:

BlockClosure>>on:do:

WindowManager>>safelyDispatchForWindowManager:

WindowManager>>processNextEvent

optimized [] in [] in WindowManager>>newProcess

BlockClosure>>on:do:

optimized [] in WindowManager>>newProcess

BlockClosure>>on:do:

optimized [] in Process class>>forBlock:priority:

 

----------------------------------------------------------------------

RxParser class>>signalSyntaxException:

Receiver:

                a RxParser class

Instance Variables:

                superclass = Object

                methodDict = a MethodDictionary[16]

                format = 16386

                subclasses = nil

                instanceVariables = an Array[2]

                organization = ('private' #characterSetFrom: #ifSpecial:then: #inputUpTo:errorMessage: #inputUpTo:nestedOn:errorMessage: #match: #next #signalParseError #signalParseError:)

('recursive descent' #atom #branch #characterSet #messagePredicate #piece #regex)

('accessing' #parse: #parseStream:)

 

                name = #RxParser

                classPool = a NameSpaceOfClass[3]

                environment = nil

Arguments:

                errorString = 'bad backslash escape'

Context PC = 6

 

----------------------------------------------------------------------

optimized [] in RxsPredicate class>>forEscapedLetter:

Receiver:

                an UndefinedObject

Context PC = 4

 

----------------------------------------------------------------------

Dictionary>>at:ifAbsent:

Receiver:

                a Dictionary

Instance Variables:

                tally = 7

Arguments:

                key = $. "16r002E"

                aBlock = BlockClosure [] in RxsPredicate class>>forEscapedLetter:

Temporaries:

                index = 13

                obj = nil

Context PC = 17

 

----------------------------------------------------------------------

RxsPredicate class>>forEscapedLetter:

Receiver:

                a RxsPredicate class

Instance Variables:

                superclass = RxsNode

                methodDict = a MethodDictionary[24]

                format = 16386

                subclasses = nil

                instanceVariables = an Array[2]

                organization = ('initialize-release' #beAlphaNumeric #beAlphabetic #beBackslash #beControl #beDigit #beGraphics #beHexDigit #beLowercase #beNotDigit #beNotSpace #beNotWordConstituent #bePrintable #bePunctuation #beSpace #beUppercase #beWordConstituent)

('accessing' #dispatchTo: #negated #predicate #predicateNegation #value:)

('testing' #isAtomic #isEnumerable)

('private' #negate)

 

                name = #RxsPredicate

                classPool = a NameSpaceOfClass[2]

                environment = nil

Arguments:

                aCharacter = $. "16r002E"

Context PC = 9

 

----------------------------------------------------------------------

RxCharSetParser>>parseEscapeChar

Receiver:

                a RxCharSetParser

Instance Variables:

                source = a ReadStream

                lookahead = $. "16r002E"

                elements = an OrderedCollection[1]

Context PC = 28

 

----------------------------------------------------------------------

RxCharSetParser>>parseStep

Receiver:

                a RxCharSetParser

Instance Variables:

                source = a ReadStream

                lookahead = $. "16r002E"

                elements = an OrderedCollection[1]

Context PC = 29

 

----------------------------------------------------------------------

RxCharSetParser>>parse

Receiver:

                a RxCharSetParser

Instance Variables:

                source = a ReadStream

                lookahead = $. "16r002E"

                elements = an OrderedCollection[1]

Context PC = 26

 

----------------------------------------------------------------------

RxParser>>characterSetFrom:

Receiver:

                a RxParser

Instance Variables:

                input = a ReadStream

                lookahead = $] "16r005D"

Arguments:

                setSpec = '\d\.'

Temporaries:

                negated = false

                spec = a ReadStream

Context PC = 28

 

----------------------------------------------------------------------

RxParser>>characterSet

Receiver:

                a RxParser

Instance Variables:

                input = a ReadStream

                lookahead = $] "16r005D"

Temporaries:

                spec = '\d\.'

                errorMessage = ' no terminating "]"'

Context PC = 43

 

----------------------------------------------------------------------

RxParser>>atom

Receiver:

                a RxParser

Instance Variables:

                input = a ReadStream

                lookahead = $] "16r005D"

Temporaries:

                atom = nil

Context PC = 83

 

----------------------------------------------------------------------

RxParser>>piece

Receiver:

                a RxParser

Instance Variables:

                input = a ReadStream

                lookahead = $] "16r005D"

Temporaries:

                atom = nil

                errorMessage = ' nullable closure'

Context PC = 6

 

----------------------------------------------------------------------

RxParser>>branch

Receiver:

                a RxParser

Instance Variables:

                input = a ReadStream

                lookahead = $] "16r005D"

Temporaries:

                piece = nil

                branch = nil

Context PC = 4

 

----------------------------------------------------------------------

RxParser>>regex

Receiver:

                a RxParser

Instance Variables:

                input = a ReadStream

                lookahead = $] "16r005D"

Temporaries:

                branch = nil

                regex = nil

Context PC = 4

 

----------------------------------------------------------------------

RxParser>>parseStream:

Receiver:

                a RxParser

Instance Variables:

                input = a ReadStream

                lookahead = $] "16r005D"

Arguments:

                aStream = a ReadStream

Temporaries:

                tree = nil

Context PC = 12

 

----------------------------------------------------------------------

RxParser>>parse:

Receiver:

                a RxParser

Instance Variables:

                input = a ReadStream

                lookahead = $] "16r005D"

Arguments:

                aString = '[\d\.]+'

Context PC = 8

 

----------------------------------------------------------------------

ByteString(CharacterArray)>>asRegex

Receiver:

                a ByteString

Context PC = 7

 

----------------------------------------------------------------------

ByteString(CharacterArray)>>matchesRegex:

Receiver:

                a ByteString

Arguments:

                regexString = '[\d\.]+'

Context PC = 3

 

-Boris

Sr. Software Engineer

DeepCove Labs

4th floor, 595 Howe Street

Vancouver, BC V6C 2T5

Canada

 

_______________________________________________
vwnc mailing list


_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc




--

Think different and code well,

-Conrad





_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: Regex11 bug?

Reinout Heeck-2


> Karsten, should it really generate a nasty message like the below?

Since you specified no exception handler: obviously yes.
Note that a signal is raised that has been properly specialized: a
RxParser syntaxErrorSignal with parameter 'bad backslash escape'. What
do you think is nasty there?


>  I'm guessing that one should be able to put any legal syntax within
> the [] and it would match or not match.

Ignoring computational complexity issues: yes (with an emphasis on
'legal' and interpreting 'any' as 'its').


>  For example, if the Regex library supports the PCRE standard
There is no PCRE standard, PCRE is merely a family of implementations.

 From the PCRE man page:
"The PCRE library is a set of functions that implement regular
expression pattern matching using the same syntax and semantics as Perl,
with just a few differences."


OTOH there /are/ several POSIX regex standards.

> which is probably the case,
RTFM, it doesn't even try. The documentation does acknowledge using
several features from both Perl regex and unix grep though.



> then one should theoretically obtain a consistent result using
> different languages as can be seen below:

If you want consistent results across languages you'll have to delegate
to the same implementation from multiple languages. When you create
bindings to a PCRE library you might have your cake and eat it too.
Until such time theory and practice will most certainly diverge...

R
-

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: Regex11 bug?

Reinout Heeck-2

Comparison tables:

   http://www.regular-expressions.info/refflavors.html

R
-

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc
Reply | Threaded
Open this post in threaded view
|

Re: Regex11 bug?

Conrad Taylor
In reply to this post by Reinout Heeck-2


---------- Forwarded message ----------
From: Conrad Taylor <[hidden email]>
Date: Tue, Jul 10, 2012 at 2:22 AM
Subject: Re: [vwnc] Regex11 bug?
To: Reinout Heeck <[hidden email]>


On Tue, Jul 10, 2012 at 1:49 AM, Reinout Heeck <[hidden email]> wrote:


> Karsten, should it really generate a nasty message like the below?

Since you specified no exception handler: obviously yes.
Note that a signal is raised that has been properly specialized: a
RxParser syntaxErrorSignal with parameter 'bad backslash escape'. What
do you think is nasty there?


I do not know enough about the Regex library that's being used here and I'm sure
that I would receive different results for similar expressions with other Smalltalks.
 

>  I'm guessing that one should be able to put any legal syntax within
> the [] and it would match or not match.

Ignoring computational complexity issues: yes (with an emphasis on
'legal' and interpreting 'any' as 'its').


>  For example, if the Regex library supports the PCRE standard
There is no PCRE standard, PCRE is merely a family of implementations.

 From the PCRE man page:
"The PCRE library is a set of functions that implement regular
expression pattern matching using the same syntax and semantics as Perl,
with just a few differences."


I meant the PCRE standard algorithms and syntax as indicated in the man page
that you're referring to in the above.
 

OTOH there /are/ several POSIX regex standards.

> which is probably the case,
RTFM, it doesn't even try. The documentation does acknowledge using
several features from both Perl regex and unix grep though.



> then one should theoretically obtain a consistent result using
> different languages as can be seen below:

If you want consistent results across languages you'll have to delegate
to the same implementation from multiple languages. When you create
bindings to a PCRE library you might have your cake and eat it too.
Until such time theory and practice will most certainly diverge...


Yes, there's a library which can be found here:

 
R
-

_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc



--

Think different and code well,

-Conrad





--

Think different and code well,

-Conrad



_______________________________________________
vwnc mailing list
[hidden email]
http://lists.cs.uiuc.edu/mailman/listinfo/vwnc