Find substrings within between 2 string fragments
Use substring() with a regular expression instead:

substring(ls.attribute_actions_text FROM 'name="(.*?)"/&gt;')


The dot (.) matches any character, *? is the non-greedy quantifier for a sequence of 0 or more matches and the parentheses (()) mark the substring to be returned.

Like your code, this selects the first string matching the pattern and does not look further.

Also, you don't need to make your expression a subquery, that adds nothing but overhead:

CREATE OR REPLACE VIEW vw_actions AS 
SELECT ls.f_table_schema
     , ls.f_table_name
     , substring(ls.attribute_actions_text FROM 'name="(.*?)"/&gt;') AS actions
FROM   layer_styles ls;


Quick test case (you should have provided):

SELECT *, substring(ls.attribute_actions_text FROM 'name="(.*?)"/&gt;')
FROM  (
   VALUES
     ('bar name="View SHED Database"/&gt; foo')
   , ('bar name="View SHED Database"/&gt; fooname="View SHED Database"/&gt;xx')
   , ('name="buntch a bull"/&gt; fooname="View SHED Database"/&gt;xx')
   , ('xxname="bla foo grr"/&gt;')
   , ('')
   , (NULL)
   ) ls(attribute_actions_text)