Get value after each last colon

后端 未结 3 1534
忘掉有多难
忘掉有多难 2021-01-26 07:14

I need to get the value of each data after the last colon. For example, I have this file:


:20:PmtReferenceID000012
:21:Not used
:25: PHMNLBICXXX/Acc         


        
3条回答
  •  不要未来只要你来
    2021-01-26 07:41

    I wrote this answer to your original post but didn't post it because it was essentially similar to the one posted by zx485.

    However, I still recommend using a key to retrieve the corresponding element name (and I also think the regex can be simpler and more robust).

    I have added a tokenizing step to split the data into separate wrappers on every double line-feed character.

    XSLT 2.0

    
    
    
    
    
    
        
            
        
    
    
    
        ABCD
        EFGH
        IJKL
        MNOP
    
    
    
    
    
        
            
                
                    
                        
                            
                        
                    
                
            
        
    
    
    
    

    Demo: http://xsltransform.net/ehVYZNm

提交回复
热议问题