sbspk
sbspk

Reputation: 133

Regular expression to get jade includes

Can you please give me any help to get jade includes with regular expression.

http://jade-lang.com/

My code looks like this

html
    body
        .container
           include header.jade
           include body part
           include footer part.jade

Regx should give

header.jade
body part
footer part.jade

I have tried this but it works for file names without spaces but fails with the file which contain spaces.

/include\s([^\n\s]+)*/g;

Upvotes: 1

Views: 598

Answers (2)

Heitor Corrêa
Heitor Corrêa

Reputation: 371

Is this what you need?

/include\s{1}[\s\w0-9]+\.jade/;

Upvotes: 0

greedybuddha
greedybuddha

Reputation: 7507

You just need to match the include with a group for the rest of the line

/include\s+(.*)/g

Upvotes: 1

Related Questions