Working with long strings
Since the Arduino Uno only has a few KB, 300 bytes is a considerable amount.

My advice:


Define a fixed char[300] array, where 300 is the max amount of characters you want to support.
Use the C (string.h) library as Majenko already suggests.


The last thing you want is that the string will be copied somehow, using up double the amount of data, or triple. It's hard to see what's going on under water, by casting or even by implicit casting a copy can be made, so 600/900 bytes are used.

For the default library, searching should work for strings longer than 256 characters. You can even write them yourself, for example if you can make it more efficient if you know something about the characters (e.g. if you can skip some because you know some patterns exist or don't exist).

Update after your comment below.

What you can try:


Try (if existing) an example sample for the barcode scanner to see if the hardware is ok. If not possible try to make a minimal sketch.
Double check the wiring (although it seems easy).
Try different wires (maybe a jumper wire is malfunctioning).
Try another sketch using serial, but without the barcode scanner (to verify RX/TX is not broken on the Arduino).