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

Phó Thủ tướng Vương Đình Huệ phê bình Tập đoàn Dầu khí trong việc xử lý các dự án thua lỗ
Công Nghệ
How To Activate Windows 7 Ultimate With Windows Loader || Windows 7 Ko Activate Kaise Kare
Công Nghệ
Hướng dẫn Loại bỏ tạp âm, tiếng ồn trong Video và Audio bằng Audition và premiere
There are currently no comments.