Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


Shells Virtual Desktop
BMail.ag - Secure Email Service
Server.net
CPLicense.net
VPS Server
Buy VPN
Vultr
VMs for AI
HostDare
HostDare
ReliableSite White-Label Dedicated Hosting for Resellers
25% Recurring Discount on NVMe VPS
InterServer VPS
BMail.ag - Secure Email Service
Best VPN
High-Performance Bare Metal Server Solutions
Karvl.com
Server Mania Cloud Hosting
DataWagon Hosting
AlphaVPS Hosting
Evoxt.com
Clouvider
VPS Hosting with NVMe
Residential IPs in the US & 4G Mobile Proxies in EU & US with Unlimited Bandwidth
ReliableSite White-Label Dedicated Hosting for Resellers
Rabisu - Hosting Solutions
CloudLinux
Shells Virtual Desktop
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

Need regexp help

LeviLevi Member

So, I came across interesting challenge, I need regexp to select everything (including match) after this:

https://pastebin.com/Mn1fynEM

My current code sucks big time:

https://pastebin.com/d2NmmeGK

Comments

  • BochiBochi Member

    I have no idea about regex, but played around a bit just for shits and giggles. :P
    What about: ^(?:(?!(?=#)).)*$

    However, I guess this would need some heavy finetuning and an or to filter the empty lines...

    Thanked by 1Falzo
  • donlidonli Member

    @LTniger said:
    So, I came across interesting challenge, I need regexp to select everything (including match) after this:

    These days this is the job of sed, python (or something called perl that looks like random characters typed). Why do you specifically need a regexp?

  • JanevskiJanevski Member
    edited May 2019
    $ cat /etc/resolv.conf 
    # Dynamic resolv.conf(5) file for glibc resolver(3) generated by resolvconf(8)
    #     DO NOT EDIT THIS FILE BY HAND -- YOUR CHANGES WILL BE OVERWRITTEN
    nameserver 127.0.1.1
    $ sed -n '/OVERWRITTEN/,$p' /etc/resolv.conf | tail -n +2
    nameserver 127.0.1.1
    $ sed -n '/YOUR CHANGES/,$p' /etc/resolv.conf | tail -n +2
    nameserver 127.0.1.1
    $ 
    

    In your case:
    sed -n '/johantheghost at yahoo period com/,$p' /path/to/file.txt | tail -n +2

    PS: Or this.
    sed -n '/# # # # # # #/,$p' /path/to/file.txt
    Anyhow this is not a regex.
    Maybe i didn't understand well enough...

  • Or this, but it is inferior potassium and needs more work:

    $ cat ~/Downloads/Mn1fynEM.sh | grep -Pzo '.*#    #  #    #  #  #    #(.*\n)*'
       #    #  #    #  #  #    #          #####   ######  #    #   ####   #    #
       #    #  ##   #  #   #  #           #    #  #       ##   #  #    #  #    #
       #    #  # #  #  #    ##            #####   #####   # #  #  #       ######
       #    #  #  # #  #    ##            #    #  #       #  # #  #       #    #
       #    #  #   ##  #   #  #           #    #  #       #   ##  #    #  #    #
        ####   #    #  #  #    #          #####   ######  #    #   ####   #    #
    
       Version 5.1.3                      Based on the Byte Magazine Unix Benchmark
    
       Multi-CPU version                  Version 5 revisions by Ian Smith,
                                          Sunnyvale, CA, USA
    $ echo "" >> ~/Downloads/Mn1fynEM.sh 
    $ cat ~/Downloads/Mn1fynEM.sh | grep -Pzo '.*#    #  #    #  #  #    #(.*\n)*'
       #    #  #    #  #  #    #          #####   ######  #    #   ####   #    #
       #    #  ##   #  #   #  #           #    #  #       ##   #  #    #  #    #
       #    #  # #  #  #    ##            #####   #####   # #  #  #       ######
       #    #  #  # #  #    ##            #    #  #       #  # #  #       #    #
       #    #  #   ##  #   #  #           #    #  #       #   ##  #    #  #    #
        ####   #    #  #  #    #          #####   ######  #    #   ####   #    #
    
       Version 5.1.3                      Based on the Byte Magazine Unix Benchmark
    
       Multi-CPU version                  Version 5 revisions by Ian Smith,
                                          Sunnyvale, CA, USA
       January 13, 2011                   johantheghost at yahoo period com
    $ 
    
Sign In or Register to comment.