Question: I'm developing an app using Apache Cordova for Visual Studio. The purpose of this app is to take a picture using the phone and upload this picture alongside with some other user input data to our company's webpage, that uses a SQL-server Database to store it's data. 

So, the question is: How can I insert data to this database so I can show it on the webpage, considering that the app will be used outside of our network? So it can't be a local connection to our database!

Answer: 
If you use `\A` instead of anchor `^` then it will fail the match:

```
# finds no match
grep -Pz -- '\A<\?xml.*\?>' file

```

This `grep` in a multiline string `^` matches at the start of every line but `\A` matches at the real start of input.
It's very unclear what you want but maybe it's:

```
awk -v RS='<[?]xml.*[?]>' '$0=RT' file

```

For example:

```
$ cat file
This is bad, real bad!
<?xml
        version="1.0"
                encoding="UTF-8" ?>
<wsdl:definitions targetNamespace="http://tips.cf"
xmlns:impl="http://tips.cf" xmlns:intf="http://tips.cf"
xmlns:apachesoap="http://xml.apache.org/xml-soap"

$ awk -v RS='<[?]xml.*[?]>' '$0=RT' file         
<?xml
        version="1.0"
                encoding="UTF-8" ?>

```

The above uses GNU awk for multi-char RS and RT. With other awks it'd be:

```
$ awk '{rec = rec $0 RS} END{ if (match(rec,/<[?]xml.*[?]>/)) print substr(rec,RSTART,RLENGTH)}' file   
<?xml
        version="1.0"
                encoding="UTF-8" ?>

```