Reducing a string to a certain amount of the first characters in R
Is there any particular reason why you want to do this via pattern matching in R? This sounds like something that SuperTranscripts and Lace might be useful for:

https://genomebiology.biomedcentral.com/articles/10.1186/s13059-017-1284-1


  Finally, Lace will annotate each superTranscript with blocks either by using the graph structure itself or alternatively using a script called Mobius (packaged with Lace) which infers the annotation from spliced junctions discovered when mapping reads to the superTranscript.