Lập Trình Linux

Practice Regular Expressions

regex [1] is for practicing POSIX Basic (Standard) and Extended Regular Expression [C-E] (0:10) with a switch for Global flag [C-G].

It has 10 problems so far, but you can add your own ones. There is a task summary for how to solving the problem, also a hint of what should or should not be matched (0:20). You will also need to solve in Replace Mode (0:45), not just in Search Mode.

The interaction is good, you can see a live highlighting on the matched parts (0:05), even showing the captured strings (0:30) (0:40).

You can also use mouse button to toggle the flags.

This has been on my list (2015-01-04T09:16:18Z) for a week, but the author took the time to handle, even now it has three PR waiting. I hope the heat hasn’t gone down.


% make
g++ regex.cpp -lcurses -lboost_regex -ltinfo -std=c++11 -o regex
/usr/lib/gcc/x86_64-pc-linux-gnu/4.7.3/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -ltinfo
collect2: error: ld returned 1 exit status
Makefile:2: recipe for target ‘all’ failed
make: *** [all] Error 1
% # take -ltinfo off
% g•+ regex.cpp -lcurses -lboost_regex -std=c++11 -o regex


% cat problems/problem4
Repeats: Match all strings that contain lol’s
a lolcat
long fall


1 abc.
2 u
3 ^”.*|.*”$
4 lo+l
5 (.*).pdf$
6 ^(.).*1$
7 .* (.*) My 1


* git-40c2d5425d2eb2cd8f0f70ae64cd09ecaf19dd86 (2015-01-05)
* In C++11 with ncurses and Boost
* By Thomas Liu, et al.
* License unspecified



Xem Thêm Bài Viết Khác:https://ftlinuxcourse.com/lap-trinh-linux

Highlights Sài Gòn – SLNA | Phan Văn Đức bỏ lỡ không tưởng trong ngày HLV Park dự khán
Âm Nhạc
Đêm Giao Thừa Nghe Một Khúc Dân Ca | Kim Thoa (Hoa Hậu Doanh Nhân Thế Giới Người Việt 2016)
Lập Trình Linux
Lập trình NodeJS căn bản – Bài 10 Review NodeJS
There are currently no comments.