GithubHelp home page GithubHelp logo

Comments (2)

favoyang avatar favoyang commented on August 17, 2024

Hi @nindim,

AFAIK, \L, \U, \E which works for Perl, are not supported in .NET regex substitutions: https://social.msdn.microsoft.com/Forums/en-US/5ae2778b-2e1a-4e3b-8471-3fe97e268f72/does-u-convert-to-uppercase-work-in-net-regex?forum=regexp

In the replacement logic, the importer also replaced the path sep (\ or /) with a dash (-) to generate a probable group name. (the method is shared for both addressable name and group name replacement parsing).

public string ParseReplacement(string assetPath, string name)
{
if (string.IsNullOrWhiteSpace(path) || string.IsNullOrWhiteSpace(name))
return null;
var cleanedName = name.Trim().Replace('/', '-').Replace('\\', '-');
// Parse path elements.
var replacement = AddressableImportRegex.ParsePath(assetPath, cleanedName);
// Parse this.path regex.
if (matchType == AddressableImportRuleMatchType.Regex)
{
string pathRegex = path;
replacement = Regex.Replace(assetPath, pathRegex, replacement);
}
return replacement;
}

I think it would be harder to achieve this unless we switch to another regex library that supports the Perl syntax or implement it ourselves. A workaround is to add a checkbox to the rule to ensure the group name are lowercase.

Thought?

from unity-addressable-importer.

nindim avatar nindim commented on August 17, 2024

Hey @favoyang,

This would definitely work for our use case!

All the best,

Niall

from unity-addressable-importer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.