First Line Blank replace with code

Tool for Search and Replace across multiple files.
User avatar
CGrouse

First Line Blank replace with code

Post by CGrouse »

I am trying to search each file and find out if the first line is empty. if first line is empty replace with <?php

File looks like this

FIRST LINE BLANK
/**


Replace with

<?php
/**


Any help is appreciated
User avatar
Fool4UAnyway

Re: First Line Blank replace with code

Post by Fool4UAnyway »

The first line in Text Crawler 2 with options set to default (Multi-line anchors unchecked) would be:
^\r\n

This includes the first end-of-line (better: newline) character(s).

You can then replacde this by any text. Be sure to add the newline character(s) again:
This text will appear on the start of the document, i.e. the first line\r\n

You can also capture the newline characters and then re-place this matching part of the regex.

Find:
^(\r\n)

Replace by:
any text$1
Post Reply