Q:

Can zero-length strings be found within a non-zero-length string?

Do non-zero-length strings (e.g. "foo") contain zero-length strings?
In other words, if I search for "" within "foo", what would be the logical result?
Is it true that there are zero-length strings before the first character, after the last character, and between every two adjacent characters of any non-zero length string?
EDIT 1: Now that I think about it, if the above is true, there could also be more than one zero-length string (even an infinite amount of them) where there could be only one.
EDIT 2:  I'm asking this question from a general perspective (just a simple doubt about the logic behind a formal language). But I want to know if there are fixed rules about this that apply to all formal languages.

A:

Yes, if you define the search that way. Different languages and search libraries might or might not do so. Consult the documentation for the language or library that you're using.
If you're writing your own search function, decide how you want it to behave and document it.
As far as I know, most string search operations will match an empty string at the beginning of a non-empty string.

