Created
          January 21, 2012 20:00 
        
      - 
      
- 
        Save rubiii/1653764 to your computer and use it in GitHub Desktop. 
    reuse xml schema pattern via nokogiri
  
        
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | <xsd:pattern xmlns:xsd="http://www.w3.org/2001/XMLSchema" value="\d{3}-[A-Z]{2}"/> | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | require "nokogiri" | |
| xml = File.read("pattern.xml") | |
| node = Nokogiri.XML(xml).root | |
| node["value"].match("123-AB") | |
| # => nil | 
        
      
            emrox
  
      
      
      commented 
        Jan 21, 2012 
      
    
  
yeah. it works. must be some other problem in this parser-wtf thingy. thx :)
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment