complex regular expression task

Posted by Don Don on Stack Overflow See other posts from Stack Overflow or by Don Don
Published on 2011-01-16T14:46:31Z Indexed on 2011/01/16 14:53 UTC
Read the original article Hit count: 198

Filed under:

Hi,

What regular expressions do I need to extract section title(s) in a text file? So, in the following sample text, I'd like to extract

  • "Communication and Leadership"
  • "1.Self-Knowledge"
  • "2. Humility"
  • "(3) Clear Thinking".

Many thanks.

Communication and Leadership
True leaders understand that, rather than forcing their followers into a preconceived mold, their job is to motivate and organize

followers to collectively accomplish goals that are in everyone's interests. The ability to communicate this to co-workers and followers is

critical to the effectiveness of leadership.

  1.Self-Knowledge Superior leaders are able to devote their

skills and energies to leadership of a group because they have worked through personal issues to

the point where they know themselves thoroughly. A high level of self-knowledge is a prerequisite to effective communication skills, because

the things that you communicate as a leader are coming from within.

  2. Humility    This subversion of personal preference requires a

certain level of humility. Although popular definitions of leaders do not always see

them as humble, the most effective leaders actually are. This humility may not be expressed in self-effacement, but in a total commitment to

the goals of the organization. Humility requires an understanding of one's own relative unimportance in comparison to larger systems.

(3) Clear Thinking    Clarity of thinking translates into clarity of

communication. A leader whose goals or personal analysis is muddled will tend to deliver

unclear or ambiguous directions to followers, leading to confusion and dissatisfaction. A leader with a clear mind who is not ambivalent

about her purposes will communicate what needs to be done in a s> traightforward and unmistakable manner.

© Stack Overflow or respective owner

Related posts about regex