N
N
Nikolai Sidorenko2015-01-15 11:47:48
Python
Nikolai Sidorenko, 2015-01-15 11:47:48

How to find substrings using regular expressions?

Given a list of headings, we must write substrings (subtext) to the table in the table. Okay, if everything went in a line,
there I have at least something with re. can do.
Text:

MGED(1)                      BRL-CAD User Commands                     MGED(1)

NAME
       mged - multi-display interactive combinatorial solid geometry editor

SYNOPSIS
       mged [-a attach] [-b] [-c] [-d display] [-h] [-r] [-x#] [-X#] [-v]
            [database.g] [mged_command]

For example, we need text from all headings like NAME and SYNOPSIS

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
DaNHell, 2015-01-15
@NSidorov

Trivially simple.
Regexr
/(\ \ \ \ \ \ \ ).*/igm

I
ivankomolin, 2015-01-15
@ivankomolin

\n[A-Z]+\s+(.*?)\s+

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question