Benjamin J. B.
Benjamin J. B.

Reputation: 1181

Textmate simple find/replace with regex

I would like to obtain this result:

  .col-xs-1       
      i.fa.fa-angellist
  .col-xs-1
      i.fa.fa-area-chart
  .col-xs-1
      i.fa.fa-at

from this code:

  .col-xs-1    

      i.fa.fa-angellist
      | fa-angellist
  .col-xs-1

      i.fa.fa-area-chart
      | fa-area-chart
  .col-xs-1

      i.fa.fa-at
      | fa-at

I've tried to find | fa-(.*) and replace it with a whitespace without success.

Upvotes: 0

Views: 142

Answers (1)

Abecee
Abecee

Reputation: 2393

Don't have TextMate to verify.

Please try to search for ^( \.col-xs-1 *\r)\r( i\.fa\.fa-[-a-z]+\r) \| fa-[-a-z]+\r and to replace with \1\2.

There is a different number of blanks in source's and result's respective first line. (I noticed as I did actually copy from your question.) If intentional, this will require the search expression's adjustment. Regarding your own search expression: The pipe character is being used to denote alternatives, and needs to be escaped if actually part of the to be matched string.

Upvotes: 1

Related Questions