Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I want to show what stands behind a regexp, for example, I want to print all chars covered by [A-z] in the bash.

share|improve this question
    
Do you realize that a regexp generally doesn't identify a single string? Actually this is the whole point of regexsps. I'm just trying to explain why I don't understand your question. –  vtest Mar 2 '11 at 15:44
    
The regex mentioned above are'nt equals [A-Za-z] but some more Characters, and I want to know them. –  mundenhof Mar 2 '11 at 16:07

1 Answer 1

up vote 1 down vote accepted

You could do something like this in Python.

import re
pattern = re.compile('[A-z]')
for ch in range(1,255):
        if (pattern.match(chr(ch))):
                print chr(ch),

Save it to a file and execute it as python your_filename. It tests every single-byte character against your regular expression and prints it out if it matches.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.