Got more questions? Find advice on: ASP | SQL | XML | Windows
in Search
Welcome to RegexAdvice Sign in | Join | Help

Monster Expression

Last post 03-29-2011, 12:37 PM by AshtonMichael. 6 replies.
Sort Posts: Previous Next
  •  03-23-2011, 10:41 AM 79462

    Monster Expression

    Hello Everyone,

     I am new to this forum and I admit from the beginning that I I'm a dummy when it comes to regular expressions. But I found something crazy in a quizzie and I need the result of it for the next step. And I am sure that you'll find it at least interesting at your end.

     Thanks in advance for any help/hint/comment, ideally a result which should be a text (might be German?) an coding sequence (don't which technology) or something else.

     

    Here it comes:

     

                                                                       
                             ''=~('('.'?'.'{'.                         
                          ('`'|'%').('['^('-')).(                      
                        '`'|'!').('`'|',').'"'.('['                    
                      ^'(').('['^'.').('`'|'"').('{'^                  
                    '[').('{'^')').'\\'.'{'.('['^'+').(                
                   '['^')').('`'|')').('`'|'.').('['^'/'               
                 ).('{'^'[').'\\'.'@'.'_'.'\\'.'}'.(('[')^             
                '(').('['^'.').('`'|'"').('{'^'[').('`'^'$'            
               ).'\\'.'{'.('{'^')').'\\'.'"'.('{'^'[').('{'^           
              '[').('{'^'[').'\\'.'\\'.('['^'/').('{'^('[')).          
             '\\'.'\\'.('['^'/').'\\'.'\\'.('['^'/').'\\'.'\\'         
            .('['^'/').('{'^'[').'\\'.'\\'.('`'|'.').'\\'.'\\'.        
           ('['^'/').'\\'.'\\'.('`'|'.').('{'^'[').('{'^'[').''.       
           '\\'.'"'.'\\'.'}'.('['^'(').('['^'.').('`'|'"').('{'^       
          '[').('{'^'#').'\\'.'{'.('{'^')').'\\'.'"'.('{'^('[')).      
         '\\'.'\\'.('`'|'.').('{'^'[').'\\'.'\\'.('['^'/').('\\').     
         '\\'.('`'|'.').('{'^'[').('{'^'[').'\\'.'"'.('{'^('[')).(     
        '['^'#').('{'^'[').('['^'(').('`'|'(').('`'|')').('`'|'&').    
        ('['^'/').'\\'.'}'.('['^'(').('['^'.').('`'|'"').('{'^'[').    
       ('`'^'-').'\\'.'{'.('{'^')').'\\'.'"'.('{'^'[').('{'^('[')).(   
       '{'^'[').'\\'.'\\'.('['^'/').('{'^'[').'\\'.'\\'.('['^('/')).   
      '\\'.'\\'.('['^'/').('{'^'[').'\\'.'\\'.('['^'/').'\\'.('\\').(  
      '`'|'.').'\\'.'"'.';'.('{'^'#').('{'^'[').('['^'(').('`'|'(').(  
      '`'|')').('`'|'&').('['^'/').';'.('`'^'$').'\\'.'}'.('['^'(').(  
     '['^'.').('`'|'"').('{'^'[').('{'^'+').'\\'.'{'.('{'^')').('\\'). 
     '"'.('{'^'[').('{'^'[').('{'^'[').'\\'.'\\'.('['^'/').('{'^"\["). 
     '\\'.'\\'.('['^'/').('{'^'[').'\\'.'\\'.('['^'/').'\\'.'\\'.('['^ 
     '/').'\\'.'\\'.('`'|'.').'\\'.'"'.';'.('{'^'#').('{'^'[').(('[')^ 
     '(').('`'|'(').('`'|')').('`'|'&').('['^'/').';'.('`'^"\$").'\\'. 
     '}'.('{'^'+').('{'^'[').('^'^('`'|')')).(':'&'=').';'.('`'^'-').( 
     '{'^'[').('^'^('`'|',')).('^'^('`'|'+')).';'.('`'^'-').('{'^'['). 
     ('^'^('`'|'*')).';'.('`'^'-').('{'^'[').('^'^('`'|'/')).('^'^('`' 
     |')')).';'.('{'^'+').('{'^'[').('^'^('`'|'/')).(':'&'=').';'.('{' 
     ^'+').('{'^'[').('^'^('`'|'*')).';'.('`'^'-').('{'^'[').(':'&'=') 
     .';'.('{'^'+').('{'^'[').('^'^('`'|'/')).('^'^('`'|'/')).';'.('`' 
     ^'-').('{'^'[').('^'^('`'|'+')).';'.('{'^'+').('{'^'[').('^'^('`' 
     |'+')).';'.('`'^'-').('{'^'[').('^'^('`'|',')).('^'^('`'|('+'))). 
     ';'.('{'^'+').('{'^'[').('^'^('`'|'-')).('^'^('`'|')')).';'.('`'^ 
     '-').('{'^'[').('^'^('`'|',')).('^'^('`'|'/')).';'.('{'^'+').('{' 
     ^'[').('^'^('`'|')')).';'.('`'^'-').('{'^'[').('^'^('`'|(','))).( 
     '^'^('`'|'-')).';'.('{'^'+').('{'^'[').('^'^('`'|'/')).('^'^('`'| 
      '(')).';'.('`'^'$').';'.('`'^'-').('{'^'[').('^'^('`'|',')).';'  
      .('{'^'+').('{'^'[').('^'^('`'|'(')).';'.('`'^'-').('{'^"\[").(  
      '^'^('`'|'*')).';'.('{'^'+').('{'^'[').('^'^('`'|'/')).';'.('`'  
       ^'-').('{'^'[').('^'^('`'|'/')).('^'^('`'|')')).';'.('{'^'+')   
       .('{'^'[').('^'^('`'|')')).('^'^('`'|')')).';'.('`'^'-').('{'   
        ^'[').('^'^('`'|'/')).('^'^('`'|',')).';'.('{'^'+').(('{')^    
        '[').('^'^('`'|'(')).';'.('{'^'+').('{'^'[').('^'^('`'|')')    
         ).';'.('`'^'-').('{'^'[').(';'&'=').';'.('{'^'+').(('{')^     
         '[').('^'^('`'|'/')).('^'^('`'|'+')).';'.('`'^'-').("\{"^     
          '[').('^'^('`'|'/')).('^'^('`'|'/')).';'.('{'^'+').('{'      
           ^'[').('^'^('`'|'/')).('^'^('`'|'.')).';'.('`'^'-').(       
           '{'^'[').('^'^('`'|'/')).('^'^('`'|'(')).';'.('{'^'+'       
            ).('{'^'[').('^'^('`'|'+')).';'.('{'^')').'\\'.'"'.        
             ('{'^'[').('{'^'[').('{'^'[').'\\'.'\\'.('['^'/')         
              .'\\'.'\\'.('['^'/').'\\'.'\\'.('['^"\/").'\\'.          
               '\\'.('['^'/').'\\'.'\\'.('['^'/').('{'^'[').           
                '\\'.'\\'.('`'|'.').'\\'.'"'.';'.('{'^'#').            
                 ('{'^'[').('^'^('`'|'/')).';'.('{'^'+').(             
                   '{'^'[').('^'^('`'|'/')).('^'^(('`')|               
                    '.')).('!'^'+').'"'.'}'.')');q{()'/                
                      ^('['^'/').'\\'.'\\'.('['^'/'].                  
                        '('['^'/').'\\'.'\\'.('['^"                    
                          '!('['^'/').'\\'.'\\'.'                      
                             '`'('['^'}=~'./^'                         
                                                                       

     

     

  •  03-23-2011, 6:36 PM 79466 in reply to 79462

    Re: Monster Expression

    While this might be an interesting challenge, as it stands it is not a valid regex pattern for any of the variants I'm aware of. The liberal use of single-quote characters throughout makes me think this might be a string version of a pattern but without any context or knowledge of the regex variant that is needed to interpret it, I doubt if it will be anything other than an interesting shape.

    Even looking at the beginning of it (and ignoring the whitespace):

    ''=~('('.'?'.'{'.('`'|'%').('['^('-')).(

    the '[' is flagged as the beginning of a character set definition that is not matched by an ending ']' (in this case the single quotes are mine and used to indicate the limit of the part of the pattern I'm discussing - they are NOT the single quotes in the pattern which a regex engine would interpret as a literal character that needs to be matched with a literal single-quote character in the text).

    The whole structure makes me think that you will need to provide a lot more information about this (perhaps the URL where you find this)  before we can start interpreting it for you as a regex pattern. A starting place for what information we need is the "Posting Guidelines" sticky note at the start of the "Construction" forum on this site where we list out the information we generally need to assist people who are trying to construct a regex pattern to suit their task. While you are effectively working backwards, we still need the same contextual information.

    Susan

  •  03-24-2011, 2:10 AM 79470 in reply to 79466

    Re: Monster Expression

    Hello Susan,

     

    Thanks a lot for taking a look. Unfortunately I do not have more information. It's a quizzie called "Linguistischer Dreisprung" on Geocaching.com.

    I tried it in http://gskinner.com/RegExr/ and it seems to be interpreted OK. However, I can't see any results.

  •  03-24-2011, 7:03 PM 79477 in reply to 79470

    Re: Monster Expression

    I don't mean to be rude, but I'm not sure that you understand what a regex pattern is.

    A regex engine needs 2 items as input and it will produce an output (of varying type depending on the regex and the way it is used).

    The first input is the "pattern" which defines the ":regular expression" or the sequence of characters that the regex engine will search for in the second input which is a text string.

    For example, if you want to find all sequences of digits in the following string:

    My dog has just turned 12 years old which is about 80 in people years

    then you might use a pattern such as

    \d+

    This pattern tells the regex engine to search for a "digit" (represented in the pattern as '\d') that may be followed by other digits (the '+' means "repeat the preceding item). This would match the "12" and "80" character sequences in the string.

    You can also search for literal strings such as 

    ear

    with find the 2nd to 4th characters of the two instances of the word "years" in the example string. However, on its own this is nothing that the normal string handling functions in most programming languages can do.

    The power of a regex is that you can combine searching for literal strings and "meta-characters" (i.e. alphabetics, digits, punctuation or your own 'character set" together with repetitions, capture groups and all the rest) to look for specific characters patterns within the source string.

    For example,

    \d{1,2}-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)-(\d{4}|[d{2})

    might be a pattern that would look for a date of the form dd-mmm-yyyy where there might be 1 or 2 digits in the day and 2 or 4 digits in the year, with the month being one of the standard 3 character abbreviations of the English name of the month.

    I've gone though all of this because you have only provided us with the pattern and no examples of the strings that might be searched by that pattern. While we may be able to interpret your pattern to see what sort of character sequences it might match, this will certainly not give you any "results" without the string to be searched.

    As far as interpretation goes, if we look at the start of your pattern:

    ''=~('('.'?'.'{'.

    this will match:

    - a literal single-quote character (')
    - followed by another literal single quote character (')
    - followed by a literal equals character (=)
    - followed by a literal tilde character (~)
    - start a capture group ( ( )
    - match a literal single quote character (')
    - start a 2nd capture group ( ( )
    - match a literal single quote character (')
    - followed by any character (except perhaps the 'newline' character that marks a line break) (.)
    - followed by an optional literal single quote character ('?)
    - followed by a literal single quote character (')
    - followed by any character (.)
    - followed by a literal single quote (')
    - there is a syntax error here in that the '{' will be interpreted as the start of a quantifier that indicates the number of times the preceding item (the literal single quote in this case). However this should be followed by a number to say the (minimum) number of times the item is to be repeated but is, instead, followed by a single quote character

    OK, if we ignore the syntax error and the unterminated capture groups (they may be terminated later in the pattern), given a string something like:

    Hello ''=~''x''y' there

    in which case the match would be on the bit in the middle.

    I hope this gives you a better idea of the question you have actually asked.

    Susan

  •  03-25-2011, 4:54 AM 79492 in reply to 79477

    Re: Monster Expression

    Hey Susan,

    Thanks so much for the thourough explanation. You're right, I may not know too much about regex's.

    But that's really all the quizzie has as input. The expression and the title.

     

    This might be too tough for me.

     

    Thanks anyway!!!

  •  03-26-2011, 12:52 PM 79545 in reply to 79492

    Re: Monster Expression

    Got it!!!

    And believe me, the result is even more weird.

    Thanks for trying to help!

  •  03-29-2011, 12:37 PM 79758 in reply to 79545

    Re: Monster Expression

    Yes you are right good post
View as RSS news feed in XML