Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1013557
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T10:07:10+00:00 2026-05-16T10:07:10+00:00

How to use fn:replace(string,pattern,replace) in XSLT is it like < fn:replace(…)/>??

  • 0

How to use

      fn:replace(string,pattern,replace) 

in XSLT

is it like < fn:replace(…)/>??

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T10:07:11+00:00Added an answer on May 16, 2026 at 10:07 am

    The function is specified as follows:

    fn:replace($input, $pattern, $replacement, [$flags])
    
    $input        xs:string?  the string to change
    $pattern      xs:string   regular expression to match the areas to be replaced
    $replacement  xs:string   the replacement string
    $flags        xs:string   flags for multiline mode, case insensitivity, etc
    return value  xs:string
    

    Note that $pattern is a regular expression, and the replacement string also has some special substitution syntax.

    Here are some examples:

    # simple replacement
    replace('query', 'r', 'as')               queasy
    
    # character class
    replace('query', '[ry]', 'l')             quell
    
    # capturing group substitution
    replace('abc123', '([a-z])', '$1x')       axbxcx123
    
    # practical example
    replace('2315551212',                     (231) 555-1212
        '(\d{3})(\d{3})(\d{4})',
        '($1) $2-$3'
    )
    

    References

    • xqueryfunctions.com – Strings – fn:replace
    • w3.org/XPath Functions – fn:replace, Flags
    • regular-expressions.info – a good tutorial
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to use batch file to insert a string to replace the
In C# it is easy to use RegEx like this string pattern = Version\\(\(\\d+).(\\d+).(\\d+).(\\d+)\\\);
I need a regex to use in Java to replace a String with UNKNOWN
I have these variables: boost::regex re //regular expression to use std::string stringToChange //replace this
I would like to use replace the value of a submit button with Loading&hellip;
I want to match a pattern, replace part of the pattern, and use a
Possible Duplicate: replace all occurrences in a string I found this question/answer: Use JavaScript
I saw use of this pattern to concatenate onto a string in some code
I have a file and want to replace a pattern with another string. #PBS
I need to write a sql update statement using REPLACE. The string looks like

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.