What Regex would capture everything from ‘ mark to the end of a line ?

What Regex would capture everything from ‘ mark to the end of a line ?

Asked on January 11, 2019 in Regex.
Add Comment


  • 2 Answer(s)

    In regex, it will be the ‘ char followed by any number of any chars including zero chars ending with end of string/line token:

    '.*$
    
    

    And to capture everything after the ‘ char but not include it in the output, use this:

    (?<=').*$
    
    

    In above code,it tell thatĀ give me all characters that follow the ‘ char until the end of the line.

    Alter:$ is implicit when using .* and not strictly required, accordingly to the pattern:

    '.*
    
    

     

    Answered on January 11, 2019.
    Add Comment

    Alternately use below code:

    '.*$
    
    

    In above code,Starting with a single quote (), match any character (.) zero or more times (*) until the end of the line ($).

    Answered on January 11, 2019.
    Add Comment


  • Your Answer

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